1999-09-12 Donn Terry <donn@interix.com>
authorIan Lance Taylor <ian@airs.com>
Sun, 12 Sep 1999 14:27:21 +0000 (14:27 +0000)
committerIan Lance Taylor <ian@airs.com>
Sun, 12 Sep 1999 14:27:21 +0000 (14:27 +0000)
* libbfd.c (bfd_log2): Rewrite to avoid infinite loop if most
significant bit is set.

bfd/ChangeLog
bfd/libbfd.c

index bf74059..7d00945 100644 (file)
@@ -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.
index d2baa5b..9620cda 100644 (file)
@@ -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;
 }