summaryrefslogtreecommitdiff
path: root/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2012-08-14 18:51:15 +0000
committerOwen Anderson <resistor@mac.com>2012-08-14 18:51:15 +0000
commitd7a85b17bdbb4cb3c3551e533d7b01984ad28a2f (patch)
tree45f9f5120c13a961e397bbd71b98e2846a7d0e44 /lib/Support/APFloat.cpp
parentf6933e6a18e8b36aff63f0c15ddc627f8a610525 (diff)
downloadllvm-d7a85b17bdbb4cb3c3551e533d7b01984ad28a2f.tar.gz
llvm-d7a85b17bdbb4cb3c3551e533d7b01984ad28a2f.tar.bz2
llvm-d7a85b17bdbb4cb3c3551e533d7b01984ad28a2f.tar.xz
Fix the construction of the magic constant for roundToIntegral to be 64-bit safe. Fixes c-torture/execute/990826-0.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161885 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r--lib/Support/APFloat.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index 2139df5620..5ea75a621a 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -1774,8 +1774,8 @@ APFloat::opStatus APFloat::roundToIntegral(roundingMode rounding_mode) {
// precision of our format, and then subtract it back off again. The choice
// of rounding modes for the addition/subtraction determines the rounding mode
// for our integral rounding as well.
- APInt IntegerConstant(NextPowerOf2(semanticsPrecision(*semantics)),
- 1 << (semanticsPrecision(*semantics)-1));
+ APInt IntegerConstant(NextPowerOf2(semanticsPrecision(*semantics)), 1);
+ IntegerConstant <<= semanticsPrecision(*semantics)-1;
APFloat MagicConstant(*semantics);
fs = MagicConstant.convertFromAPInt(IntegerConstant, false,
rmNearestTiesToEven);