* gas/sh/err-le.s, gas/sh/err-be.s: New tests.
[deliverable/binutils-gdb.git] / libiberty / ffs.c
CommitLineData
7b78baae
DD
1/* ffs -- Find the first bit set in the parameter
2
3NAME
4 ffs -- Find the first bit set in the parameter
5
6SYNOPSIS
7 int ffs (int valu)
8
9DESCRIPTION
10 Find the first bit set in the parameter. Bits are numbered from
11 right to left, starting with bit 1.
12
13*/
14
15int
16ffs (valu)
17 register int valu;
18{
19 register int bit;
20
21 if (valu == 0)
22 return 0;
23
24 for (bit = 1; !(valu & 1); bit++)
25 valu >>= 1;
26
27 return bit;
28}
29
This page took 0.034227 seconds and 4 git commands to generate.