[APInt] Don't shift into the sign bit

llvm-svn: 273727
This commit is contained in:
David Majnemer 2016-06-24 21:15:36 +00:00
parent a895a0cd01
commit 0399226cf9
1 changed files with 1 additions and 1 deletions

View File

@ -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));