[llvm-commits] [llvm] r78899 - /llvm/trunk/include/llvm/Support/MathExtras.h

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Aug 12 23:24:02 PDT 2009


Author: stoklund
Date: Thu Aug 13 01:24:02 2009
New Revision: 78899

URL: http://llvm.org/viewvc/llvm-project?rev=78899&view=rev
Log:
Fix the N>=64 case in the isInt<> and isUint<> templates.

Modified:
    llvm/trunk/include/llvm/Support/MathExtras.h

Modified: llvm/trunk/include/llvm/Support/MathExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MathExtras.h?rev=78899&r1=78898&r2=78899&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/MathExtras.h (original)
+++ llvm/trunk/include/llvm/Support/MathExtras.h Thu Aug 13 01:24:02 2009
@@ -54,12 +54,12 @@
 
 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





More information about the llvm-commits mailing list