summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/APInt.h
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
commit4bda52d6b5ffa13314fe32baa1784566f70483f9 (patch)
treefd7eb87e378ab3116f89e3fb1d0446e3f20081c7 /include/llvm/ADT/APInt.h
parenteb13d1b710c385437f30f944de44a5b7053069f3 (diff)
downloadllvm-4bda52d6b5ffa13314fe32baa1784566f70483f9.tar.gz
llvm-4bda52d6b5ffa13314fe32baa1784566f70483f9.tar.bz2
llvm-4bda52d6b5ffa13314fe32baa1784566f70483f9.tar.xz
add a method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35860 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APInt.h')
-rw-r--r--include/llvm/ADT/APInt.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index d80c601d27..c514d24bcf 100644
--- a/include/llvm/ADT/APInt.h
+++ b/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
/// @{