mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-29 08:15:16 +00:00
[APInt] Don't shift into the sign bit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ab8ffadc13
commit
87d5e72f1d
@ -880,7 +880,7 @@ double APInt::roundToDouble(bool isSigned) const {
|
||||
// It is wrong to optimize getWord(0) to VAL; there might be more than one word.
|
||||
if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
|
||||
if (isSigned) {
|
||||
int64_t sext = (int64_t(getWord(0)) << (64-BitWidth)) >> (64-BitWidth);
|
||||
int64_t sext = SignExtend64(getWord(0), BitWidth);
|
||||
return double(sext);
|
||||
} else
|
||||
return double(getWord(0));
|
||||
|
Loading…
x
Reference in New Issue
Block a user