aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-03-30 23:17:11 +0000
committerIan Lance Taylor <ian@airs.com>2009-03-30 23:17:11 +0000
commit154b857c95773f7ea7fa3b5cb5ad90b0b06c2760 (patch)
treeb4fadfb926d8c81b16f828c1cef4f944e244d9da /gold/ffsll.c
parentbinutils/ (diff)
downloadbinutils-gdb-154b857c95773f7ea7fa3b5cb5ad90b0b06c2760.tar.gz
binutils-gdb-154b857c95773f7ea7fa3b5cb5ad90b0b06c2760.tar.bz2
binutils-gdb-154b857c95773f7ea7fa3b5cb5ad90b0b06c2760.zip
* ffsll.c (ffsll): Correct implementation.
Diffstat (limited to 'gold/ffsll.c')
-rw-r--r--gold/ffsll.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gold/ffsll.c b/gold/ffsll.c
index aeae845f094..b247bc30af3 100644
--- a/gold/ffsll.c
+++ b/gold/ffsll.c
@@ -36,8 +36,13 @@ ffsll (long long arg)
unsigned long long i;
int ret;
- ret = 0;
- for (i = (unsigned long long) arg; i != 0; i >>= 1)
- ++ret;
+ if (arg == 0)
+ ret = 0;
+ else
+ {
+ ret = 1;
+ for (i = (unsigned long long) arg; (i & 1) == 0; i >>= 1)
+ ++ret;
+ }
return ret;
}