mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-13 09:33:50 +00:00
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
This commit is contained in:
parent
7afa166c76
commit
7ccd9ec4f4
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user