diff options
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 1ea6319acfa..48b9613b3ec 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -428,11 +428,12 @@ APInt APInt::extractBits(unsigned numBits, unsigned bitPosition) const { unsigned NumSrcWords = getNumWords(); unsigned NumDstWords = Result.getNumWords(); + uint64_t *DestPtr = Result.isSingleWord() ? &Result.U.VAL : Result.U.pVal; for (unsigned word = 0; word < NumDstWords; ++word) { uint64_t w0 = U.pVal[loWord + word]; uint64_t w1 = (loWord + word + 1) < NumSrcWords ? U.pVal[loWord + word + 1] : 0; - Result.U.pVal[word] = (w0 >> loBit) | (w1 << (APINT_BITS_PER_WORD - loBit)); + DestPtr[word] = (w0 >> loBit) | (w1 << (APINT_BITS_PER_WORD - loBit)); } return Result.clearUnusedBits(); |