From f6615236701639ca9def021e73da39cec77d9fbf Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 10 Apr 2007 07:06:21 +0000 Subject: [PATCH] add missing methods, mark stuff const llvm-svn: 35862 --- include/llvm/ADT/APSInt.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h index d75c7094cd4..77c1c9a9843 100644 --- a/include/llvm/ADT/APSInt.h +++ b/include/llvm/ADT/APSInt.h @@ -68,13 +68,21 @@ public: *this = sdiv(RHS); return *this; } + APSInt operator%(const APSInt &RHS) const { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + return IsUnsigned ? urem(RHS) : srem(RHS); + } + APSInt operator/(const APSInt &RHS) const { + assert(IsUnsigned == RHS.IsUnsigned && "Signedness mismatch!"); + return IsUnsigned ? udiv(RHS) : sdiv(RHS); + } const APSInt &operator>>=(unsigned Amt) { *this = *this >> Amt; return *this; } - APSInt operator>>(unsigned Amt) { + APSInt operator>>(unsigned Amt) const { return IsUnsigned ? lshr(Amt) : ashr(Amt); }