Fix compile errors about shift counts too large.
authorCary Coutant <ccoutant@gmail.com>
Sun, 7 Feb 2016 02:18:51 +0000 (18:18 -0800)
committerCary Coutant <ccoutant@gmail.com>
Sun, 7 Feb 2016 02:19:13 +0000 (18:19 -0800)
commitb7a4e9d8e6a854d2344ab7963e531d6f19571d2e
treea6dd8e6719363d4993fba756b00d1e7c7af25d71
parent6c043259a33c19377d7e1b056fb37eab5055c169
Fix compile errors about shift counts too large.

In order to get around the optimizer and newer compiler warnings
about shift counts, the overflow checking code had resorted to
some messy shifting, and with the never-before-seen instantiations
of the template functions, we were still running afoul of the
compiler checks.

This patch replaces those messy shift sequences with a simple
class template that provides the min and max limits for any
bit size up to 64, with a specialization for 64 that prevents
the compiler from complaining.

gold/
PR gold/19577
* reloc.h (Limits): New class.
(Bits::has_overflow32): Use min/max values from Limits.
(Bits::has_unsigned_overflow32): Likewise.
(Bits::has_signed_unsigned_overflow32): Likewise.
(Bits::has_overflow): Likewise.
(Bits::has_unsigned_overflow): Likewise.
(Bits::has_signed_unsigned_overflow64): Likewise.
gold/ChangeLog
gold/reloc.h