Add isPositive for symmetry with isNegative.
authorReid Spencer <rspencer@reidspencer.com>
Sat, 3 Mar 2007 00:24:39 +0000 (00:24 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sat, 3 Mar 2007 00:24:39 +0000 (00:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34862 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APInt.h

index 07e22fc9828dd6bd696537c3827dcdbc039f08a9..aec9e5610a604a451b6ed902f0d4439bc145f671 100644 (file)
@@ -106,7 +106,7 @@ class APInt {
   /// @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 @@ public:
     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;