mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 05:01:59 +01:00
[APInt] Remove an unneeded extra temporary APInt from toString.
Turns out udivrem can write its output to the same location as one of its inputs so the extra temporary isn't needed. llvm-svn: 302772
This commit is contained in:
parent
584e78cfa3
commit
c1ef9481dc
@ -1953,15 +1953,11 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix,
|
||||
} else {
|
||||
APInt divisor(Tmp.getBitWidth(), Radix);
|
||||
APInt APdigit;
|
||||
APInt tmp2(Tmp.getBitWidth(), 0);
|
||||
while (Tmp.getBoolValue()) {
|
||||
udivrem(Tmp, divisor, tmp2, APdigit);
|
||||
udivrem(Tmp, divisor, Tmp, APdigit);
|
||||
unsigned Digit = (unsigned)APdigit.getZExtValue();
|
||||
assert(Digit < Radix && "divide failed");
|
||||
Str.push_back(Digits[Digit]);
|
||||
// Move the quotient into Tmp and move the old allocation of Tmp into
|
||||
// tmp2 to be used on the next loop iteration.
|
||||
std::swap(Tmp, tmp2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user