add missing methods, mark stuff const
authorChris Lattner <sabre@nondot.org>
Tue, 10 Apr 2007 07:06:21 +0000 (07:06 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 10 Apr 2007 07:06:21 +0000 (07:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35862 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/APSInt.h

index d75c7094cd4324be8206393bd73effdfd12d122b..77c1c9a984364868264d1f4259784df485a16cb6 100644 (file)
@@ -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);
   }