[llvm-commits] CVS: llvm/include/llvm/ADT/APSInt.h

Chris Lattner sabre at nondot.org
Tue Apr 10 00:06:40 PDT 2007



Changes in directory llvm/include/llvm/ADT:

APSInt.h updated: 1.1 -> 1.2
---
Log message:

add missing methods, mark stuff const


---
Diffs of the changes:  (+9 -1)

 APSInt.h |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletion(-)


Index: llvm/include/llvm/ADT/APSInt.h
diff -u llvm/include/llvm/ADT/APSInt.h:1.1 llvm/include/llvm/ADT/APSInt.h:1.2
--- llvm/include/llvm/ADT/APSInt.h:1.1	Thu Apr  5 00:20:11 2007
+++ llvm/include/llvm/ADT/APSInt.h	Tue Apr 10 02:06:21 2007
@@ -68,13 +68,21 @@
       *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);
   }
   






More information about the llvm-commits mailing list