From: Eli Friedman Date: Wed, 12 Oct 2011 21:56:19 +0000 (+0000) Subject: Fix APFloat::getSmallestNormalized so the shift doesn't depend on undefined behavior... X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=90196fced249e2bfe693391022541b802a7b8aa7;p=oota-llvm.git Fix APFloat::getSmallestNormalized so the shift doesn't depend on undefined behavior. Patch from Ahmed Charles. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141818 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 95df8617fb5..f2388944929 100644 --- a/lib/Support/APFloat.cpp +++ b/lib/Support/APFloat.cpp @@ -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; }