Updated: April 19, 2023 |
Find the first bit that's set in a bit string
#include <strings.h> int ffs( int value ); int ffsl( long int value ); int ffsll( long long int value );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The ffs(), ffsl(), and ffsll() functions find the first (least significant) bit that's set in value and return the index of that bit. Bits are numbered starting from 1, starting at the least significant bit.
The index of the first bit that's set, or 0 if value is zero.
ffs() is POSIX 1003.1 XSI; ffsl() and ffsll() are Unix
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |