[llvm-commits] [llvm] r161885 - /llvm/trunk/lib/Support/APFloat.cpp

Owen Anderson resistor at mac.com
Tue Aug 14 11:51:16 PDT 2012


Author: resistor
Date: Tue Aug 14 13:51:15 2012
New Revision: 161885

URL: http://llvm.org/viewvc/llvm-project?rev=161885&view=rev
Log:
Fix the construction of the magic constant for roundToIntegral to be 64-bit safe.  Fixes c-torture/execute/990826-0.c

Modified:
    llvm/trunk/lib/Support/APFloat.cpp

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=161885&r1=161884&r2=161885&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Tue Aug 14 13:51:15 2012
@@ -1774,8 +1774,8 @@
   // 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);





More information about the llvm-commits mailing list