forked from OSchip/llvm-project
[APInt] Take advantage of new operator*=(uint64_t) to remove a temporary APInt.
llvm-svn: 302403
This commit is contained in:
parent
a51941f314
commit
f15bec5541
|
@ -1842,10 +1842,6 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
|
||||||
// Figure out if we can shift instead of multiply
|
// Figure out if we can shift instead of multiply
|
||||||
unsigned shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0);
|
unsigned shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0);
|
||||||
|
|
||||||
// Set up an APInt for the radix multiplier outside the loop so we don't
|
|
||||||
// constantly construct/destruct it.
|
|
||||||
APInt apradix(getBitWidth(), radix);
|
|
||||||
|
|
||||||
// Enter digit traversal loop
|
// Enter digit traversal loop
|
||||||
for (StringRef::iterator e = str.end(); p != e; ++p) {
|
for (StringRef::iterator e = str.end(); p != e; ++p) {
|
||||||
unsigned digit = getDigit(*p, radix);
|
unsigned digit = getDigit(*p, radix);
|
||||||
|
@ -1856,7 +1852,7 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
|
||||||
if (shift)
|
if (shift)
|
||||||
*this <<= shift;
|
*this <<= shift;
|
||||||
else
|
else
|
||||||
*this *= apradix;
|
*this *= radix;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add in the digit we just interpreted
|
// Add in the digit we just interpreted
|
||||||
|
|
Loading…
Reference in New Issue