diff options
| author | Ted Kremenek <kremenek@apple.com> | 2008-09-19 18:01:14 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2008-09-19 18:01:14 +0000 |
| commit | 36d4cbc382ef924d0cbe2f25e989f2cdfbe3f826 (patch) | |
| tree | 373df708bd4e79b16abc58ccdbe0b3054e54dc0a | |
| parent | 34bfd8a490e65ac024e39b2f9b4a2f2fa7ea92c2 (diff) | |
| download | bcm5719-llvm-36d4cbc382ef924d0cbe2f25e989f2cdfbe3f826.tar.gz bcm5719-llvm-36d4cbc382ef924d0cbe2f25e989f2cdfbe3f826.zip | |
Added static methods to APSInt: getMinValue and getMaxValue.
llvm-svn: 56355
| -rw-r--r-- | llvm/include/llvm/ADT/APSInt.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/APSInt.h b/llvm/include/llvm/ADT/APSInt.h index f16f49dc79e..ef689f87b2d 100644 --- a/llvm/include/llvm/ADT/APSInt.h +++ b/llvm/include/llvm/ADT/APSInt.h @@ -234,6 +234,20 @@ public: return APSInt(~static_cast<const APInt&>(*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; |

