[llvm-commits] CVS: llvm/lib/Support/APInt.cpp

Chris Lattner sabre at nondot.org
Thu May 3 11:15:54 PDT 2007



Changes in directory llvm/lib/Support:

APInt.cpp updated: 1.78 -> 1.79
---
Log message:

silence some annoying gcc 4.3 warnings


---
Diffs of the changes:  (+10 -7)

 APInt.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)


Index: llvm/lib/Support/APInt.cpp
diff -u llvm/lib/Support/APInt.cpp:1.78 llvm/lib/Support/APInt.cpp:1.79
--- llvm/lib/Support/APInt.cpp:1.78	Fri Apr 13 19:00:10 2007
+++ llvm/lib/Support/APInt.cpp	Thu May  3 13:15:36 2007
@@ -1066,11 +1066,12 @@
   // If all the bits were shifted out, the result is, technically, undefined.
   // We return -1 if it was negative, 0 otherwise. We check this early to avoid
   // issues in the algorithm below.
-  if (shiftAmt == BitWidth)
+  if (shiftAmt == BitWidth) {
     if (isNegative())
       return APInt(BitWidth, -1ULL);
     else
       return APInt(BitWidth, 0);
+  }
 
   // Create some space for the result.
   uint64_t * val = new uint64_t[getNumWords()];
@@ -1108,7 +1109,7 @@
 
     // Deal with sign extenstion in the break word, and possibly the word before
     // it.
-    if (isNegative())
+    if (isNegative()) {
       if (wordShift > bitsInWord) {
         if (breakWord > 0)
           val[breakWord-1] |= 
@@ -1116,6 +1117,7 @@
         val[breakWord] |= ~0ULL;
       } else 
         val[breakWord] |= (~0ULL << (bitsInWord - wordShift));
+    }
   }
 
   // Remaining words are 0 or -1, just assign them.
@@ -1128,11 +1130,12 @@
 /// Logical right-shift this APInt by shiftAmt.
 /// @brief Logical right-shift function.
 APInt APInt::lshr(uint32_t shiftAmt) const {
-  if (isSingleWord())
+  if (isSingleWord()) {
     if (shiftAmt == BitWidth)
       return APInt(BitWidth, 0);
     else 
       return APInt(BitWidth, this->VAL >> shiftAmt);
+  }
 
   // If all the bits were shifted out, the result is 0. This avoids issues
   // with shifting by the size of the integer type, which produces undefined
@@ -1760,10 +1763,10 @@
   bool isNeg = str[0] == '-';
   if (isNeg)
     str++, slen--;
-  assert(slen <= numbits || radix != 2 && "Insufficient bit width");
-  assert(slen*3 <= numbits || radix != 8 && "Insufficient bit width");
-  assert(slen*4 <= numbits || radix != 16 && "Insufficient bit width");
-  assert((slen*64)/22 <= numbits || radix != 10 && "Insufficient bit width");
+  assert((slen <= numbits || radix != 2) && "Insufficient bit width");
+  assert((slen*3 <= numbits || radix != 8) && "Insufficient bit width");
+  assert((slen*4 <= numbits || radix != 16) && "Insufficient bit width");
+  assert(((slen*64)/22 <= numbits || radix != 10) && "Insufficient bit width");
 
   // Allocate memory
   if (!isSingleWord())






More information about the llvm-commits mailing list