llvm.org GIT mirror llvm / 7ccd9ec
Add extend and extOrTrunc methods that do sign or zero extension depending on whether the integer is signed or not git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40724 91177308-0d34-0410-b5e6-96231b3b80d8 Anders Carlsson 13 years ago
1 changed file(s) with 16 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
8282 return *this;
8383 }
8484
85 APSInt& extend(uint32_t width) {
86 if (IsUnsigned)
87 *this = zext(width);
88 else
89 *this = sext(width);
90 return *this;
91 }
92
93 APSInt& extOrTrunc(uint32_t width) {
94 if (IsUnsigned)
95 *this = zextOrTrunc(width);
96 else
97 *this = sextOrTrunc(width);
98 return *this;
99 }
100
85101 APSInt operator>>(unsigned Amt) const {
86102 return IsUnsigned ? lshr(Amt) : ashr(Amt);
87103 }