Name
ffs, ffsl, fls, flsl
- find first bit set in a word
Library
libc.lib
Synopsis
Return values
Detailed description
The
ffs
and
ffsl
functions find the first bit set in
value
and return the index of that bit.
The
fls
and
flsl
functions find the last bit set in
value
and return the index of that bit.
Bits are numbered starting from 1, starting at the right-most
(least significant) bit.
A return value of zero from any of these functions means that the
argument was zero.
Examples
#include <string.h>
#include <stdio.h>
int main()
{
int i = 0x10;
int j = ffs(i);
if(j == 5) printf("First bit position in 0x10 is %d\n",j);
return 0;
}
Output
First bit position in 0x10 is 5
Feedback
For additional information or queries on this page send feedback
© 2008 Nokia Corporation. All rights reserved. This documentation can be used in the connection with this Product to help and support the user. |
|