ffs, ffsl, ffsll, fls, flsl, flsll - find first or last bit set in a bit string
#include <strings.h> int ffs(int value);
#include <string.h> int ffsl(long value);
int ffsll(long long value);
int fls(int value);
int flsl(long value);
int flsll(long long value);
The ffs(), ffsl(), and ffsll() functions find the first bit set in value and return the position of that bit.
The fls(), flsl(), and flsll() functions find the last bit set in value and return the position of that bit.
Bits are numbered starting at one (the least significant bit).
These functions return the position of the requested bit, or 0 if no bits are set in value.
No errors are defined.
See attributes(7) for descriptions of the following attributes:
See standards(7) for descriptions of the following standards:
The ffsl(), fls(), and flsl() functions appeared in FreeBSD 5.3. The ffsll() and flsll() functions appeared in FreeBSD 7.1. All of these functions were added to Oracle Solaris in the Solaris 11.0 release.
The ffs() function appeared in 4.3BSD. It was added to Solaris in the Solaris 2.0 release, with a prototype in the <string.h> header. The prototype for ffs() was added to the <strings.h> header in the Solaris 2.6 release as required by the XPG4v2 standard.