diff options
author | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-05 17:24:39 +0000 |
---|---|---|
committer | dj <dj@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-05 17:24:39 +0000 |
commit | 8568af222660626565421b8cff22c897806172ea (patch) | |
tree | e1a90952f7c17b7f4189ba7c65da694b76a2b58c /libiberty/ffs.c | |
parent | a130b9001ec2a8273cbe7c1eee3a7cf9a77b8424 (diff) | |
download | gcc-8568af222660626565421b8cff22c897806172ea.tar.gz |
* Makefile.in: Add ffs.c dependency.
* configure.in: Add ffs.c.
* ffs.c: New file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43784 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/ffs.c')
-rw-r--r-- | libiberty/ffs.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/libiberty/ffs.c b/libiberty/ffs.c new file mode 100644 index 00000000000..8ffb03e7c5e --- /dev/null +++ b/libiberty/ffs.c @@ -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; +} + |