[llvm-commits] CVS: llvm/include/llvm/ADT/APInt.h
Zhou Sheng
zhousheng00 at gmail.com
Mon Mar 12 23:16:43 PDT 2007
Changes in directory llvm/include/llvm/ADT:
APInt.h updated: 1.41 -> 1.42
---
Log message:
Add zextOrCopy() into APInt for convenience.
---
Diffs of the changes: (+9 -0)
APInt.h | 9 +++++++++
1 files changed, 9 insertions(+)
Index: llvm/include/llvm/ADT/APInt.h
diff -u llvm/include/llvm/ADT/APInt.h:1.41 llvm/include/llvm/ADT/APInt.h:1.42
--- llvm/include/llvm/ADT/APInt.h:1.41 Sun Mar 11 01:16:10 2007
+++ llvm/include/llvm/ADT/APInt.h Tue Mar 13 01:16:26 2007
@@ -450,6 +450,15 @@
/// @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();
More information about the llvm-commits
mailing list