diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-03-24 22:37:23 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-03-24 22:37:23 +0000 |
commit | d3af825d29ab02f78665d5010c8439d34d65db65 (patch) | |
tree | 3192e65548a5ddf20be0ab6908d4c388aa4e056e | |
parent | 9f992aec98e0384739baf485468dd403c790dd53 (diff) |
Undo the last change and make this really implement remainder and not
modulus. The previous change was a result of incorrect documentation in
the LangRef.html.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35305 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/llvm/ADT/APInt.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 52509ed000..76a852b1a0 100644 --- a/include/llvm/ADT/APInt.h +++ b/include/llvm/ADT/APInt.h @@ -552,9 +552,11 @@ public: return this->udiv(RHS); } - /// Perform an Unsigned remainder operation on this APInt with RHS being the + /// Perform an unsigned remainder operation on this APInt with RHS being the /// divisor. Both this and RHS are treated as unsigned quantities for purposes - /// of this operation. + /// of this operation. Note that this is a true remainder operation and not + /// a modulo operation because the sign follows the sign of the dividend + /// which is *this. /// @returns a new APInt value containing the remainder result /// @brief Unsigned remainder operation. APInt urem(const APInt& RHS) const; @@ -566,9 +568,9 @@ public: if (RHS.isNegative()) return -((-(*this)).urem(-RHS)); else - return (-(*this)).urem(RHS); + return -(-(*this)).urem(RHS); else if (RHS.isNegative()) - return -(this->urem(-RHS)); + return this->urem(-RHS); return this->urem(RHS); } |