diff options
-rw-r--r-- | include/llvm/ADT/APSInt.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/llvm/ADT/APSInt.h b/include/llvm/ADT/APSInt.h index 4eb4be2317..a2f0321c8b 100644 --- a/include/llvm/ADT/APSInt.h +++ b/include/llvm/ADT/APSInt.h @@ -83,6 +83,22 @@ public: return *this; } + APSInt& extend(uint32_t width) { + if (IsUnsigned) + *this = zext(width); + else + *this = sext(width); + return *this; + } + + APSInt& extOrTrunc(uint32_t width) { + if (IsUnsigned) + *this = zextOrTrunc(width); + else + *this = sextOrTrunc(width); + return *this; + } + APSInt operator>>(unsigned Amt) const { return IsUnsigned ? lshr(Amt) : ashr(Amt); } |