[llvm-commits] [llvm] r60446 - /llvm/trunk/include/llvm/ADT/APInt.h

Chris Lattner sabre at nondot.org
Tue Dec 2 15:33:30 PST 2008


Author: lattner
Date: Tue Dec  2 17:33:29 2008
New Revision: 60446

URL: http://llvm.org/viewvc/llvm-project?rev=60446&view=rev
Log:
Fix isIntN to work with APInts > 64 bits.  This method is only
used by clang apparently.

Modified:
    llvm/trunk/include/llvm/ADT/APInt.h

Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=60446&r1=60445&r2=60446&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Tue Dec  2 17:33:29 2008
@@ -333,12 +333,14 @@
   /// @brief Check if this APInt has an N-bits unsigned integer value.
   bool isIntN(uint32_t N) const {
     assert(N && "N == 0 ???");
-    if (isSingleWord()) {
+    if (N >= getBitWidth())
+      return true;
+    
+    if (isSingleWord())
       return VAL == (VAL & (~0ULL >> (64 - N)));
-    } else {
-      APInt Tmp(N, getNumWords(), pVal);
-      return Tmp == (*this);
-    }
+    APInt Tmp(N, getNumWords(), pVal);
+    Tmp.zext(getBitWidth());
+    return Tmp == (*this);
   }
 
   /// @brief Check if this APInt has an N-bits signed integer value.





More information about the llvm-commits mailing list