[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h

Reid Spencer reid at x10sys.com
Fri Mar 2 16:24:55 PST 2007



Changes in directory llvm/include/llvm/ADT:

APInt.h updated: 1.35 -> 1.36
---
Log message:

Add isPositive for symmetry with isNegative.


---
Diffs of the changes:  (+8 -1)

 APInt.h |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.35 llvm/include/llvm/ADT/APInt.h:1.36
--- llvm/include/llvm/ADT/APInt.h:1.35	Thu Mar  1 17:37:09 2007
+++ llvm/include/llvm/ADT/APInt.h	Fri Mar  2 18:24:39 2007
@@ -106,7 +106,7 @@
   /// @returns a uint64_t type integer with just bit position at
   /// "whichBit(bitPosition)" setting, others zero.
   static inline uint64_t maskBit(uint32_t bitPosition) { 
-    return (static_cast<uint64_t>(1)) << whichBit(bitPosition); 
+    return 1ULL << whichBit(bitPosition); 
   }
 
   /// This method is used internally to clear the to "N" bits that are not used
@@ -365,6 +365,13 @@
     return (*this)[BitWidth - 1];
   }
 
+  /// This just tests the high bit of the APInt to determine if the value is
+  /// positove or not.
+  /// @brief Determine if this APInt Value is positive.
+  bool isPositive() const {
+    return !isNegative();
+  }
+
   /// Arithmetic right-shift this APInt by shiftAmt.
   /// @brief Arithmetic right-shift function.
   APInt ashr(uint32_t shiftAmt) const;






More information about the llvm-commits mailing list