From: Chris Lattner Date: Tue, 10 Apr 2007 06:43:18 +0000 (+0000) Subject: add a method X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4bda52d6b5ffa13314fe32baa1784566f70483f9;p=oota-llvm.git add a method git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35860 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index d80c601d274..c514d24bcf1 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 /// @{