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

Eli Friedman eli.friedman at gmail.com
Wed Oct 12 14:56:19 PDT 2011


Author: efriedma
Date: Wed Oct 12 16:56:19 2011
New Revision: 141818

URL: http://llvm.org/viewvc/llvm-project?rev=141818&view=rev
Log:
Fix APFloat::getSmallestNormalized so the shift doesn't depend on undefined behavior.  Patch from Ahmed Charles.


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=141818&r1=141817&r2=141818&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Wed Oct 12 16:56:19 2011
@@ -3275,7 +3275,7 @@
   Val.exponent = Sem.minExponent;
   Val.zeroSignificand();
   Val.significandParts()[partCountForBits(Sem.precision)-1] |=
-    (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1));
+    (((integerPart) 1) << ((Sem.precision - 1) % integerPartWidth));
 
   return Val;
 }





More information about the llvm-commits mailing list