summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-09-19 18:01:14 +0000
committerTed Kremenek <kremenek@apple.com>2008-09-19 18:01:14 +0000
commit36d4cbc382ef924d0cbe2f25e989f2cdfbe3f826 (patch)
tree373df708bd4e79b16abc58ccdbe0b3054e54dc0a
parent34bfd8a490e65ac024e39b2f9b4a2f2fa7ea92c2 (diff)
downloadbcm5719-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.h14
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;
OpenPOWER on IntegriCloud