projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7afa166
)
Add extend and extOrTrunc methods that do sign or zero extension depending on whether...
author
Anders Carlsson
<andersca@mac.com>
Thu, 2 Aug 2007 06:00:13 +0000
(06:00 +0000)
committer
Anders Carlsson
<andersca@mac.com>
Thu, 2 Aug 2007 06:00:13 +0000
(06:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40724
91177308
-0d34-0410-b5e6-
96231b3b80d8
include/llvm/ADT/APSInt.h
patch
|
blob
|
history
diff --git
a/include/llvm/ADT/APSInt.h
b/include/llvm/ADT/APSInt.h
index 4eb4be231765d948cd29b90ffdd19a2eeaa43204..a2f0321c8bbef95ad24fc28b194126aee573c5a3 100644
(file)
--- 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);
}