[llvm-commits] [llvm] r56355 - /llvm/trunk/include/llvm/ADT/APSInt.h
Ted Kremenek
kremenek at apple.com
Fri Sep 19 11:01:14 PDT 2008
Author: kremenek
Date: Fri Sep 19 13:01:14 2008
New Revision: 56355
URL: http://llvm.org/viewvc/llvm-project?rev=56355&view=rev
Log:
Added static methods to APSInt: getMinValue and getMaxValue.
Modified:
llvm/trunk/include/llvm/ADT/APSInt.h
Modified: llvm/trunk/include/llvm/ADT/APSInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APSInt.h?rev=56355&r1=56354&r2=56355&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APSInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APSInt.h Fri Sep 19 13:01:14 2008
@@ -234,6 +234,20 @@
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;
More information about the llvm-commits
mailing list