[APInt] Simplify some code by using operator+=(uint64_t) instead of doing a more complex assignment into a temporary APInt just to use the APInt operator+=.

llvm-svn: 299324
This commit is contained in:
Craig Topper 2017-04-02 06:59:38 +00:00
parent d7ed50de26
commit b7d8faa231
1 changed files with 2 additions and 7 deletions

View File

@ -2168,9 +2168,8 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
// Figure out if we can shift instead of multiply
unsigned shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0);
// Set up an APInt for the digit to add outside the loop so we don't
// Set up an APInt for the radix multiplier outside the loop so we don't
// constantly construct/destruct it.
APInt apdigit(getBitWidth(), 0);
APInt apradix(getBitWidth(), radix);
// Enter digit traversal loop
@ -2187,11 +2186,7 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
}
// Add in the digit we just interpreted
if (apdigit.isSingleWord())
apdigit.VAL = digit;
else
apdigit.pVal[0] = digit;
*this += apdigit;
*this += digit;
}
// If its negative, put it in two's complement form
if (isNeg) {