Updated: April 19, 2023 |
Find the last bit that's set in a bit string
#include <strings.h> int fls( int value ); int flsl( long int value ); int flsll( long long int value );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The fls(), flsl(), and flsll() functions find the last (most 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 last bit that's set, or 0 if value is zero.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |