llvm.org GIT mirror llvm / a5ae15e
silence some annoying gcc 4.3 warnings git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36680 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 13 years ago
1 changed file(s) with 10 addition(s) and 7 deletion(s). Raw diff Collapse all Expand all
10651065 // If all the bits were shifted out, the result is, technically, undefined.
10661066 // We return -1 if it was negative, 0 otherwise. We check this early to avoid
10671067 // issues in the algorithm below.
1068 if (shiftAmt == BitWidth)
1068 if (shiftAmt == BitWidth) {
10691069 if (isNegative())
10701070 return APInt(BitWidth, -1ULL);
10711071 else
10721072 return APInt(BitWidth, 0);
1073 }
10731074
10741075 // Create some space for the result.
10751076 uint64_t * val = new uint64_t[getNumWords()];
11071108
11081109 // Deal with sign extenstion in the break word, and possibly the word before
11091110 // it.
1110 if (isNegative())
1111 if (isNegative()) {
11111112 if (wordShift > bitsInWord) {
11121113 if (breakWord > 0)
11131114 val[breakWord-1] |=
11151116 val[breakWord] |= ~0ULL;
11161117 } else
11171118 val[breakWord] |= (~0ULL << (bitsInWord - wordShift));
1119 }
11181120 }
11191121
11201122 // Remaining words are 0 or -1, just assign them.
11271129 /// Logical right-shift this APInt by shiftAmt.
11281130 /// @brief Logical right-shift function.
11291131 APInt APInt::lshr(uint32_t shiftAmt) const {
1130 if (isSingleWord())
1132 if (isSingleWord()) {
11311133 if (shiftAmt == BitWidth)
11321134 return APInt(BitWidth, 0);
11331135 else
11341136 return APInt(BitWidth, this->VAL >> shiftAmt);
1137 }
11351138
11361139 // If all the bits were shifted out, the result is 0. This avoids issues
11371140 // with shifting by the size of the integer type, which produces undefined
17591762 bool isNeg = str[0] == '-';
17601763 if (isNeg)
17611764 str++, slen--;
1762 assert(slen <= numbits || radix != 2 && "Insufficient bit width");
1763 assert(slen*3 <= numbits || radix != 8 && "Insufficient bit width");
1764 assert(slen*4 <= numbits || radix != 16 && "Insufficient bit width");
1765 assert((slen*64)/22 <= numbits || radix != 10 && "Insufficient bit width");
1765 assert((slen <= numbits || radix != 2) && "Insufficient bit width");
1766 assert((slen*3 <= numbits || radix != 8) && "Insufficient bit width");
1767 assert((slen*4 <= numbits || radix != 16) && "Insufficient bit width");
1768 assert(((slen*64)/22 <= numbits || radix != 10) && "Insufficient bit width");
17661769
17671770 // Allocate memory
17681771 if (!isSingleWord())