Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4.2 |
both |
#define _XOPEN_SOURCE_EXTENDED 1
#include <strings.h>
int ffs(int i);
The ffs() function finds the first bit set (beginning with the least significant bit) and returns the index of that bit. Bits are numbered starting at one (the least significant bit).
If successful, ffs() returns the index of the first bit set.
If i is 0, ffs() returns 0.
There are no errno values defined.