Fix sext operation. Shifting by zero would leave an incorrect mask.
authorReid Spencer <rspencer@reidspencer.com>
Sun, 25 Feb 2007 23:54:00 +0000 (23:54 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Sun, 25 Feb 2007 23:54:00 +0000 (23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34617 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index 09a600ffa2c7751344f9ed9e695ae7d9ca15445c..e13778609bbd35b8d33f29f67c130b82027f65a6 100644 (file)
@@ -889,7 +889,7 @@ void APInt::sext(uint32_t width) {
     return;
   }
 
-  uint64_t mask = ~0ULL << wordBits;
+  uint64_t mask = wordBits == 0 ? 0 : ~0ULL << wordBits;
   uint64_t *newVal = getMemory(wordsAfter);
   if (wordsBefore == 1)
     newVal[0] = VAL | mask;