From ed871805f718f6bd0f9f32888b82c66545fc1157 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Fri, 19 Sep 2008 18:01:14 +0000 Subject: [PATCH] Added static methods to APSInt: getMinValue and getMaxValue. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56355 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/APSInt.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h index f16f49dc79e..ef689f87b2d 100644 --- a/include/llvm/ADT/APSInt.h +++ b/include/llvm/ADT/APSInt.h @@ -234,6 +234,20 @@ public: return APSInt(~static_cast(*this), IsUnsigned); } + /// getMaxValue - Return the APSInt representing the maximum integer value + /// with the given bit width and signedness. + static APSInt getMaxValue(uint32_t numBits, bool Signed) { + return APSInt(Signed ? APInt::getSignedMaxValue(numBits) + : APInt::getMaxValue(numBits), Signed); + } + + /// getMinValue - Return the APSInt representing the minimum integer value + /// with the given bit width and signedness. + static APSInt getMinValue(uint32_t numBits, bool Signed) { + return APSInt(Signed ? APInt::getSignedMinValue(numBits) + : APInt::getMinValue(numBits), Signed); + } + /// Profile - Used to insert APSInt objects, or objects that contain APSInt /// objects, into FoldingSets. void Profile(FoldingSetNodeID& ID) const; -- 2.34.1