merge from gcc

This commit is contained in:
DJ Delorie
2001-07-05 17:29:17 +00:00
parent af703f9620
commit 7b78baae9b
5 changed files with 40 additions and 3 deletions

29
libiberty/ffs.c Normal file
View File

@@ -0,0 +1,29 @@
/* ffs -- Find the first bit set in the parameter
NAME
ffs -- Find the first bit set in the parameter
SYNOPSIS
int ffs (int valu)
DESCRIPTION
Find the first bit set in the parameter. Bits are numbered from
right to left, starting with bit 1.
*/
int
ffs (valu)
register int valu;
{
register int bit;
if (valu == 0)
return 0;
for (bit = 1; !(valu & 1); bit++)
valu >>= 1;
return bit;
}