Fix APFloat::getSmallestNormalized so the shift doesn't depend on undefined behavior...
authorEli Friedman <eli.friedman@gmail.com>
Wed, 12 Oct 2011 21:56:19 +0000 (21:56 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Wed, 12 Oct 2011 21:56:19 +0000 (21:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141818 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APFloat.cpp

index 95df8617fb5c4ead5a87c1ad4c73df0c0427c343..f2388944929bf097ddfddb1bc11c437079a6110e 100644 (file)
@@ -3275,7 +3275,7 @@ APFloat APFloat::getSmallestNormalized(const fltSemantics &Sem, bool Negative) {
   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;
 }