* as.h (alloca): Don't declare if __GNUC__. Remove an old comment.
[binutils.git] / libiberty / ffs.c
blob8ffb03e7c5e2ab762e43797c4a3a36057b28b770
1 /* ffs -- Find the first bit set in the parameter
3 NAME
4 ffs -- Find the first bit set in the parameter
6 SYNOPSIS
7 int ffs (int valu)
9 DESCRIPTION
10 Find the first bit set in the parameter. Bits are numbered from
11 right to left, starting with bit 1.
15 int
16 ffs (valu)
17 register int valu;
19 register int bit;
21 if (valu == 0)
22 return 0;
24 for (bit = 1; !(valu & 1); bit++)
25 valu >>= 1;
27 return bit;