namespace llvm {
+/// An arbitrary precision integer that knows its signedness.
class LLVM_NODISCARD APSInt : public APInt {
bool IsUnsigned;
/// Default constructor that creates an uninitialized APInt.
explicit APSInt() : IsUnsigned(false) {}
- /// APSInt ctor - Create an APSInt with the specified width, default to
- /// unsigned.
+ /// Create an APSInt with the specified width, default to unsigned.
explicit APSInt(uint32_t BitWidth, bool isUnsigned = true)
: APInt(BitWidth, 0), IsUnsigned(isUnsigned) {}
void setIsUnsigned(bool Val) { IsUnsigned = Val; }
void setIsSigned(bool Val) { IsUnsigned = !Val; }
- /// toString - Append this APSInt to the specified SmallString.
+ /// Append this APSInt to the specified SmallString.
void toString(SmallVectorImpl<char> &Str, unsigned Radix = 10) const {
APInt::toString(Str, Radix, isSigned());
}
- /// toString - Converts an APInt to a std::string. This is an inefficient
+ /// Converts an APInt to a std::string. This is an inefficient
/// method; you should prefer passing in a SmallString instead.
std::string toString(unsigned Radix) const {
return APInt::toString(Radix, isSigned());
return APSInt(~static_cast<const APInt&>(*this), IsUnsigned);
}
- /// getMaxValue - Return the APSInt representing the maximum integer value
- /// with the given bit width and signedness.
+ /// Return the APSInt representing the maximum integer value with the given
+ /// bit width and signedness.
static APSInt getMaxValue(uint32_t numBits, bool Unsigned) {
return APSInt(Unsigned ? APInt::getMaxValue(numBits)
: APInt::getSignedMaxValue(numBits), Unsigned);
}
- /// getMinValue - Return the APSInt representing the minimum integer value
- /// with the given bit width and signedness.
+ /// Return the APSInt representing the minimum integer value with the given
+ /// bit width and signedness.
static APSInt getMinValue(uint32_t numBits, bool Unsigned) {
return APSInt(Unsigned ? APInt::getMinValue(numBits)
: APInt::getSignedMinValue(numBits), Unsigned);
static APSInt get(int64_t X) { return APSInt(APInt(64, X), false); }
static APSInt getUnsigned(uint64_t X) { return APSInt(APInt(64, X), true); }
- /// Profile - Used to insert APSInt objects, or objects that contain APSInt
- /// objects, into FoldingSets.
+ /// Used to insert APSInt objects, or objects that contain APSInt objects,
+ /// into FoldingSets.
void Profile(FoldingSetNodeID& ID) const;
};