diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-10-12 21:56:19 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-10-12 21:56:19 +0000 |
commit | 90196fced249e2bfe693391022541b802a7b8aa7 (patch) | |
tree | 6cde06ccd16861695ea4381282ad54a5630d53ab /lib/Support/APFloat.cpp | |
parent | 7247a5f20e1997e38cdfe3558afe8f10d547f2eb (diff) |
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
Diffstat (limited to 'lib/Support/APFloat.cpp')
-rw-r--r-- | lib/Support/APFloat.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp index 95df8617fb..f238894492 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; } |