diff options
author | Ian Lance Taylor <ian@airs.com> | 1999-09-12 14:27:21 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1999-09-12 14:27:21 +0000 |
commit | 86b21447e77052598ff93b6aa0b2db3ccda45d76 (patch) | |
tree | 3cb6c47706e9d24c306b35214258dcaac3126250 | |
parent | 61feeec2ee170d8507b75181bb683b6e63ea5610 (diff) | |
download | gdb-86b21447e77052598ff93b6aa0b2db3ccda45d76.zip gdb-86b21447e77052598ff93b6aa0b2db3ccda45d76.tar.gz gdb-86b21447e77052598ff93b6aa0b2db3ccda45d76.tar.bz2 |
1999-09-12 Donn Terry <donn@interix.com>
* libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most
significant bit is set.
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/libbfd.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bf74059..7d00945 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +1999-09-12 Donn Terry <donn@interix.com> + + * libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most + significant bit is set. + 1999-09-11 Ian Lance Taylor <ian@zembu.com> * coff-ppc.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define. diff --git a/bfd/libbfd.c b/bfd/libbfd.c index d2baa5b..9620cda 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -1260,7 +1260,7 @@ bfd_log2 (x) { unsigned int result = 0; - while ((((bfd_vma) 1) << result) < x) + while ((x = (x >> 1)) != 0) ++result; return result; } |