mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
constify these methods.
llvm-svn: 116455
This commit is contained in:
parent
151502662e
commit
093d5fe0a9
@ -808,10 +808,10 @@ public:
|
||||
// Operations that return overflow indicators.
|
||||
|
||||
// ssub_ov - Signed subtraction. Unsigned subtraction never overflows.
|
||||
APInt sadd_ov(const APInt &RHS, bool &Overflow);
|
||||
APInt ssub_ov(const APInt &RHS, bool &Overflow);
|
||||
APInt sdiv_ov(const APInt &RHS, bool &Overflow);
|
||||
APInt smul_ov(const APInt &RHS, bool &Overflow);
|
||||
APInt sadd_ov(const APInt &RHS, bool &Overflow) const;
|
||||
APInt ssub_ov(const APInt &RHS, bool &Overflow) const;
|
||||
APInt sdiv_ov(const APInt &RHS, bool &Overflow) const;
|
||||
APInt smul_ov(const APInt &RHS, bool &Overflow) const;
|
||||
APInt sshl_ov(unsigned Amt, bool &Overflow);
|
||||
|
||||
/// @returns the bit value at bitPosition
|
||||
|
@ -2046,27 +2046,27 @@ void APInt::udivrem(const APInt &LHS, const APInt &RHS,
|
||||
divide(LHS, lhsWords, RHS, rhsWords, &Quotient, &Remainder);
|
||||
}
|
||||
|
||||
APInt APInt::sadd_ov(const APInt &RHS, bool &Overflow) {
|
||||
APInt APInt::sadd_ov(const APInt &RHS, bool &Overflow) const {
|
||||
APInt Res = *this+RHS;
|
||||
Overflow = isNonNegative() == RHS.isNonNegative() &&
|
||||
Res.isNonNegative() != isNonNegative();
|
||||
return Res;
|
||||
}
|
||||
|
||||
APInt APInt::ssub_ov(const APInt &RHS, bool &Overflow) {
|
||||
APInt APInt::ssub_ov(const APInt &RHS, bool &Overflow) const {
|
||||
APInt Res = *this - RHS;
|
||||
Overflow = isNonNegative() != RHS.isNonNegative() &&
|
||||
Res.isNonNegative() != isNonNegative();
|
||||
return Res;
|
||||
}
|
||||
|
||||
APInt APInt::sdiv_ov(const APInt &RHS, bool &Overflow) {
|
||||
APInt APInt::sdiv_ov(const APInt &RHS, bool &Overflow) const {
|
||||
// MININT/-1 --> overflow.
|
||||
Overflow = isMinSignedValue() && RHS.isAllOnesValue();
|
||||
return sdiv(RHS);
|
||||
}
|
||||
|
||||
APInt APInt::smul_ov(const APInt &RHS, bool &Overflow) {
|
||||
APInt APInt::smul_ov(const APInt &RHS, bool &Overflow) const {
|
||||
APInt Res = *this * RHS;
|
||||
|
||||
if (*this != 0 && RHS != 0)
|
||||
@ -2076,7 +2076,7 @@ APInt APInt::smul_ov(const APInt &RHS, bool &Overflow) {
|
||||
return Res;
|
||||
}
|
||||
|
||||
APInt APInt::sshl_ov(unsigned ShAmt, bool &Overflow) {
|
||||
APInt APInt::sshl_ov(unsigned ShAmt, bool &Overflow) const {
|
||||
Overflow = ShAmt >= getBitWidth();
|
||||
if (Overflow)
|
||||
ShAmt = getBitWidth()-1;
|
||||
|
Loading…
Reference in New Issue
Block a user