summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-04-10 06:43:18 +0000
committerChris Lattner <sabre@nondot.org>2007-04-10 06:43:18 +0000
commitc43883c8a9ebf5eee3998191c9de5629a06ba3a7 (patch)
tree50f3ad86e7f35f125312f6b49260828e40433027 /llvm
parent9b6d69e0c214fd0925290b3053f418fa29fbc28c (diff)
downloadbcm5719-llvm-c43883c8a9ebf5eee3998191c9de5629a06ba3a7.tar.gz
bcm5719-llvm-c43883c8a9ebf5eee3998191c9de5629a06ba3a7.zip
add a method
llvm-svn: 35860
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/ADT/APInt.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index d80c601d274..c514d24bcf1 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -281,6 +281,13 @@ public:
return *this != 0;
}
+ /// getLimitedValue - Return this value, or return all ones if it is too large
+ /// to return.
+ uint64_t getLimitedValue(uint64_t Limit = ~0ULL) const {
+ return (getActiveBits() > 64 || getZExtValue() > Limit) ?
+ Limit : getZExtValue();
+ }
+
/// @}
/// @name Value Generators
/// @{
OpenPOWER on IntegriCloud