[llvm-commits] CVS: llvm/lib/Support/APInt.cpp
Reid Spencer
reid at x10sys.com
Thu Mar 1 17:19:59 PST 2007
Changes in directory llvm/lib/Support:
APInt.cpp updated: 1.64 -> 1.65
---
Log message:
Fix a problem where shifting by 64-bits leads to incorrect results on PPC
but not on X86 becuase shift by word size is "undefined".
---
Diffs of the changes: (+4 -1)
APInt.cpp | 5 ++++-
1 files changed, 4 insertions(+), 1 deletion(-)
Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.64 llvm/lib/Support/APInt.cpp:1.65
--- llvm/lib/Support/APInt.cpp:1.64 Thu Mar 1 17:30:25 2007
+++ llvm/lib/Support/APInt.cpp Thu Mar 1 19:19:42 2007
@@ -938,7 +938,10 @@
if (wordsBefore == wordsAfter) {
uint32_t newWordBits = width % APINT_BITS_PER_WORD;
// The extension is contained to the wordsBefore-1th word.
- uint64_t mask = (~0ULL >> (APINT_BITS_PER_WORD - newWordBits)) << wordBits;
+ uint64_t mask = ~0ULL;
+ if (newWordBits)
+ mask >>= APINT_BITS_PER_WORD - newWordBits;
+ mask <<= wordBits;
if (wordsBefore == 1)
VAL |= mask;
else
More information about the llvm-commits
mailing list