[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Zhou Sheng
zhousheng00 at gmail.com
Mon Mar 12 10:48:02 PDT 2007
Changes in directory llvm/lib/Support:
APInt.cpp updated: 1.69 -> 1.70
---
Log message:
For APInt::z/sext(width), if width == BitWidth, just return *this.
---
Diffs of the changes: (+4 -0)
APInt.cpp | 4 ++++
1 files changed, 4 insertions(+)
Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.69 llvm/lib/Support/APInt.cpp:1.70
--- llvm/lib/Support/APInt.cpp:1.69 Sun Mar 4 18:00:42 2007
+++ llvm/lib/Support/APInt.cpp Mon Mar 12 12:47:45 2007
@@ -921,6 +921,8 @@
// Sign extend to a new width.
APInt &APInt::sext(uint32_t width) {
+ if (width == BitWidth)
+ return *this;
assert(width > BitWidth && "Invalid APInt SignExtend request");
assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
// If the sign bit isn't set, this is the same as zext.
@@ -969,6 +971,8 @@
// Zero extend to a new width.
APInt &APInt::zext(uint32_t width) {
+ if (width == BitWidth)
+ return *this;
assert(width > BitWidth && "Invalid APInt ZeroExtend request");
assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
uint32_t wordsBefore = getNumWords();
More information about the llvm-commits
mailing list