diff options
author | Dale Johannesen <dalej@apple.com> | 2009-08-12 17:42:34 +0000 |
---|---|---|
committer | Dale Johannesen <dalej@apple.com> | 2009-08-12 17:42:34 +0000 |
commit | 39c177d8b7b03d5a851a3adf5ae816da1211c49e (patch) | |
tree | b429b7482fd9a6db3d8f593a6d1b14ff2345b960 /lib/Support/APInt.cpp | |
parent | 6b018979da52c9760363b8b74951bbe259044ea8 (diff) |
Fix a nondeterministic bug in APInt::roundToDouble;
when !isSingleWord() but getActiveBits() is small,
we were using the pointer value instead of the low
word of the integer value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78821 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APInt.cpp')
-rw-r--r-- | lib/Support/APInt.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index a034fd1e79..6638fccfef 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -897,10 +897,10 @@ double APInt::roundToDouble(bool isSigned) const { // Handle the simple case where the value is contained in one uint64_t. if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) { if (isSigned) { - int64_t sext = (int64_t(VAL) << (64-BitWidth)) >> (64-BitWidth); + int64_t sext = (int64_t(getWord(0)) << (64-BitWidth)) >> (64-BitWidth); return double(sext); } else - return double(VAL); + return double(getWord(0)); } // Determine if the value is negative. |