[llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 10 16:40:03 PST 2003


Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.33 -> 1.34

---
Log message:

Fix ConstantUInt::isAllOnesValue



---
Diffs of the changes:

Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.33 llvm/lib/VMCore/Constants.cpp:1.34
--- llvm/lib/VMCore/Constants.cpp:1.33	Thu Mar  6 15:02:18 2003
+++ llvm/lib/VMCore/Constants.cpp	Mon Mar 10 16:39:02 2003
@@ -173,6 +173,13 @@
   }
 }
 
+bool ConstantUInt::isAllOnesValue() const {
+  unsigned TypeBits = getType()->getPrimitiveSize()*8;
+  uint64_t Val = ~0ULL;                // All ones
+  Val >>= 64-TypeBits;                 // Shift out inappropriate bits
+  return getValue() == Val;
+}
+
 
 //===----------------------------------------------------------------------===//
 //                            ConstantXXX Classes





More information about the llvm-commits mailing list