diff options
author | Chris Lattner <sabre@nondot.org> | 2007-04-10 07:06:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-04-10 07:06:21 +0000 |
commit | 403949ea93d78796fcd803e75c97b68e53e331a9 (patch) | |
tree | deb81e6c91070ec9a3ac47813a67dbae71bbf470 /include/llvm/ADT/APSInt.h | |
parent | 99b1b38818e3a1628e39af40500bad47d5207d0d (diff) | |
download | llvm-403949ea93d78796fcd803e75c97b68e53e331a9.tar.gz llvm-403949ea93d78796fcd803e75c97b68e53e331a9.tar.bz2 llvm-403949ea93d78796fcd803e75c97b68e53e331a9.tar.xz |
add missing methods, mark stuff const
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35862 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APSInt.h')
-rw-r--r-- | include/llvm/ADT/APSInt.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h index d75c7094cd..77c1c9a984 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); } |