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 | d433042388345f85ced99eb5e5b4f1a581b3e424 (patch) | |
tree | f7cdf390c93d02c554b3219d4163005371d92328 /llvm/lib/Support/APFloat.cpp | |
parent | 724e62bb4a23bbc81589580f99e46d00e3f21dc2 (diff) | |
download | bcm5719-llvm-d433042388345f85ced99eb5e5b4f1a581b3e424.tar.gz bcm5719-llvm-d433042388345f85ced99eb5e5b4f1a581b3e424.zip |
Fix APFloat::getSmallestNormalized so the shift doesn't depend on undefined behavior. Patch from Ahmed Charles.
llvm-svn: 141818
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 95df8617fb5..f2388944929 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/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; } |