fix a comment bug Reid noticed
[oota-llvm.git] / include / llvm / ADT / APInt.h
index d80c601d274909a9775538a67a89930bb12bf948..d9470ee3c80a4d52de4a179141b34371b504afea 100644 (file)
@@ -281,6 +281,14 @@ public:
     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();
+  }
+
   /// @}
   /// @name Value Generators
   /// @{