fix a comment bug Reid noticed
[oota-llvm.git] / include / llvm / ADT / APInt.h
index df90753f636c28e59352f27519c722a489e7b661..d9470ee3c80a4d52de4a179141b34371b504afea 100644 (file)
@@ -278,7 +278,15 @@ public:
   /// This converts the APInt to a boolean value as a test against zero.
   /// @brief Boolean conversion function. 
   inline bool getBoolValue() const {
-    return countLeadingZeros() != BitWidth;
+    return *this != 0;
+  }
+
+  /// getLimitedValue - If this value is smaller than the specified limit,
+  /// return it, otherwise return the limit value.  This causes the value
+  /// to saturate to the limit.
+  uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
+    return (getActiveBits() > 64 || getZExtValue() > Limit) ?
+      Limit :  getZExtValue();
   }
 
   /// @}