[llvm-commits] [llvm] r116455 - in /llvm/trunk: include/llvm/ADT/APInt.h lib/Support/APInt.cpp
Chris Lattner
sabre at nondot.org
Wed Oct 13 16:54:10 PDT 2010
Author: lattner
Date: Wed Oct 13 18:54:10 2010
New Revision: 116455
URL: http://llvm.org/viewvc/llvm-project?rev=116455&view=rev
Log:
constify these methods.
Modified:
llvm/trunk/include/llvm/ADT/APInt.h
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=116455&r1=116454&r2=116455&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Wed Oct 13 18:54:10 2010
@@ -808,10 +808,10 @@
// 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
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=116455&r1=116454&r2=116455&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Wed Oct 13 18:54:10 2010
@@ -2046,27 +2046,27 @@
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 @@
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;
More information about the llvm-commits
mailing list