From: Ian Lance Taylor Date: Sun, 12 Sep 1999 14:27:21 +0000 (+0000) Subject: 1999-09-12 Donn Terry X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86b21447e77052598ff93b6aa0b2db3ccda45d76;p=binutils-gdb.git 1999-09-12 Donn Terry * libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most significant bit is set. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bf74059a7ef..7d00945bc22 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +1999-09-12 Donn Terry + + * libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most + significant bit is set. + 1999-09-11 Ian Lance Taylor * coff-ppc.c (COFF_SECTION_ALIGNMENT_ENTRIES): Define. diff --git a/bfd/libbfd.c b/bfd/libbfd.c index d2baa5b3a2c..9620cda7068 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; }