diff options
| author | Craig Topper <craig.topper@gmail.com> | 2017-04-02 06:59:38 +0000 |
|---|---|---|
| committer | Craig Topper <craig.topper@gmail.com> | 2017-04-02 06:59:38 +0000 |
| commit | b7d8faa2314a486af49df30c8c5e034ff0578fd6 (patch) | |
| tree | 077e0285c0610fa436e9ec2b313275f083f91095 /llvm | |
| parent | d7ed50de260ffe660d1a3308599b006237155025 (diff) | |
| download | bcm5719-llvm-b7d8faa2314a486af49df30c8c5e034ff0578fd6.tar.gz bcm5719-llvm-b7d8faa2314a486af49df30c8c5e034ff0578fd6.zip | |
[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
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Support/APInt.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index b5e6310d468..22a393c6f31 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -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) { |

