Fix incorrect casts.
authorCary Coutant <ccoutant@gmail.com>
Sat, 6 Feb 2016 18:28:36 +0000 (10:28 -0800)
committerCary Coutant <ccoutant@gmail.com>
Sat, 6 Feb 2016 18:28:36 +0000 (10:28 -0800)
gold/
PR gold/19577
* reloc.h (Bits::has_unsigned_overflow32): Fix static_cast.
(Bits::has_unsigned_overflow): Remove unnecessary static_cast.

gold/ChangeLog
gold/reloc.h

index ba0b973..a8184fc 100644 (file)
@@ -1,6 +1,12 @@
 2016-02-06  Cary Coutant  <ccoutant@gmail.com>
 
        PR gold/19577
+       * reloc.h (Bits::has_unsigned_overflow32): Fix static_cast.
+       (Bits::has_unsigned_overflow): Remove unnecessary static_cast.
+
+2016-02-06  Cary Coutant  <ccoutant@gmail.com>
+
+       PR gold/19577
        * reloc.h (Bits::has_unsigned_overflow32): Fix unsigned/signed
        comparison.
        (Bits::has_unsigned_overflow): Likewise.
index fce7313..9c09c7c 100644 (file)
@@ -1015,7 +1015,7 @@ class Bits
     gold_assert(bits > 0 && bits <= 32);
     if (bits == 32)
       return false;
-    uint32_t max = static_cast<int32_t>((1U << bits) - 1);
+    uint32_t max = static_cast<uint32_t>((1U << bits) - 1);
     return val > max;
   }
 
@@ -1081,7 +1081,7 @@ class Bits
     gold_assert(bits > 0 && bits <= 64);
     if (bits == 64)
       return false;
-    uint64_t max = static_cast<int64_t>((static_cast<uint64_t>(1) << bits) - 1);
+    uint64_t max = (static_cast<uint64_t>(1) << bits) - 1;
     return val > max;
   }