summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit0b35722533c417a53c02eac527cc90762ace6e45 (patch)
tree7ff9388d20bba3ff1cfce3fab517c9af4437a04f /llvm/lib/Support/APFloat.cpp
parent799ad50ffb7b060bc993de42c2d1f74bf156d3b8 (diff)
downloadbcm5719-llvm-0b35722533c417a53c02eac527cc90762ace6e45.tar.gz
bcm5719-llvm-0b35722533c417a53c02eac527cc90762ace6e45.zip
Fix the construction of the magic constant for roundToIntegral to be 64-bit safe. Fixes c-torture/execute/990826-0.c
llvm-svn: 161885
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 2139df56205..5ea75a621ad 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud