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:
771dbf7
)
Add zextOrCopy() into APInt for convenience.
author
Zhou Sheng
<zhousheng00@gmail.com>
Tue, 13 Mar 2007 06:16:26 +0000
(06:16 +0000)
committer
Zhou Sheng
<zhousheng00@gmail.com>
Tue, 13 Mar 2007 06:16:26 +0000
(06:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35079
91177308
-0d34-0410-b5e6-
96231b3b80d8
include/llvm/ADT/APInt.h
patch
|
blob
|
history
diff --git
a/include/llvm/ADT/APInt.h
b/include/llvm/ADT/APInt.h
index 5c8e0ee553d41bc9d1aefa28b668457efbd81fc8..3d479da4b8340b5648b78932c32f2424979d1617 100644
(file)
--- a/
include/llvm/ADT/APInt.h
+++ b/
include/llvm/ADT/APInt.h
@@
-450,6
+450,15
@@
public:
/// @brief Zero extend or truncate to width
APInt &zextOrTrunc(uint32_t width);
+ /// This is a help function for convenience. If the given \p width equals to
+ /// this APInt's BitWidth, just return this APInt, otherwise, just zero
+ /// extend it.
+ inline APInt &zextOrCopy(uint32_t width) {
+ if (width == BitWidth)
+ return *this;
+ return zext(width);
+ }
+
/// @brief Set every bit to 1.
APInt& set();