diff options
author | Ian Lance Taylor <ian@airs.com> | 2009-03-30 23:17:11 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2009-03-30 23:17:11 +0000 |
commit | 154b857c95773f7ea7fa3b5cb5ad90b0b06c2760 (patch) | |
tree | b4fadfb926d8c81b16f828c1cef4f944e244d9da | |
parent | 93abc97ad29ee908645f5efbd70d7ec4f179bcf5 (diff) | |
download | gdb-154b857c95773f7ea7fa3b5cb5ad90b0b06c2760.zip gdb-154b857c95773f7ea7fa3b5cb5ad90b0b06c2760.tar.gz gdb-154b857c95773f7ea7fa3b5cb5ad90b0b06c2760.tar.bz2 |
* ffsll.c (ffsll): Correct implementation.
-rw-r--r-- | gold/ChangeLog | 4 | ||||
-rw-r--r-- | gold/ffsll.c | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/gold/ChangeLog b/gold/ChangeLog index b6ad2e2..0726507 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,7 @@ +2009-03-30 Ian Lance Taylor <iant@google.com> + + * ffsll.c (ffsll): Correct implementation. + 2009-03-27 Ian Lance Taylor <iant@google.com> * ffsll.c: New file. diff --git a/gold/ffsll.c b/gold/ffsll.c index aeae845..b247bc3 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; } |