aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/ADT/APSInt.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h
index f16f49dc79..ef689f87b2 100644
--- a/include/llvm/ADT/APSInt.h
+++ b/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;