Fix the N>=64 case in the isInt<> and isUint<> templates.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 13 Aug 2009 06:24:02 +0000 (06:24 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Thu, 13 Aug 2009 06:24:02 +0000 (06:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78899 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/MathExtras.h

index 15a67e4029913d930bdd3486112e33e3305031b6..7ba5d8661cccdc5721606ca1da08725f875cb3af 100644 (file)
@@ -54,12 +54,12 @@ inline bool isUInt32(int64_t Value) {
 
 template<unsigned N>
 inline bool isInt(int64_t x) {
-  return -(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1));
+  return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
 }
 
 template<unsigned N>
 inline bool isUint(uint64_t x) {
-  return x < (UINT64_C(1)<<N);
+  return N >= 64 || x < (UINT64_C(1)<<N);
 }
 
 /// isMask_32 - This function returns true if the argument is a sequence of ones