Mark _init and _fini for --gc-sections
[deliverable/binutils-gdb.git] / libiberty / ffs.c
CommitLineData
7b78baae
DD
1/* ffs -- Find the first bit set in the parameter
2
ba19b94f 3@deftypefn Supplemental int ffs (int @var{valu})
7b78baae 4
5d852400 5Find the first (least significant) bit set in @var{valu}. Bits are
ba19b94f
DD
6numbered from right to left, starting with bit 1 (corresponding to the
7value 1). If @var{valu} is zero, zero is returned.
7b78baae 8
ba19b94f 9@end deftypefn
7b78baae
DD
10
11*/
12
13int
49b1fae4 14ffs (register int valu)
7b78baae
DD
15{
16 register int bit;
17
18 if (valu == 0)
19 return 0;
20
21 for (bit = 1; !(valu & 1); bit++)
22 valu >>= 1;
23
24 return bit;
25}
26
This page took 0.557947 seconds and 4 git commands to generate.