summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-12 21:51:36 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-12 21:51:36 +0000
commitc53220134a2c4e09606f2eb35c3763ec33f24edb (patch)
tree54eb5f4b053b45c1cea4fd88875ee7856f2a5d1c /llvm/lib/Support/APFloat.cpp
parentf903c154c7cc15484b042e602cbdfa54e06fbac7 (diff)
downloadbcm5719-llvm-c53220134a2c4e09606f2eb35c3763ec33f24edb.tar.gz
bcm5719-llvm-c53220134a2c4e09606f2eb35c3763ec33f24edb.zip
Fix APFloat::getLargest so that it actually returns the correct value. Found by accident while reviewing a patch to nearby code.
llvm-svn: 141816
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 5307829ed83..95df8617fb5 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -3243,8 +3243,9 @@ APFloat APFloat::getLargest(const fltSemantics &Sem, bool Negative) {
significand[i] = ~((integerPart) 0);
// ...and then clear the top bits for internal consistency.
- significand[N-1] &=
- (((integerPart) 1) << ((Sem.precision % integerPartWidth) - 1)) - 1;
+ if (Sem.precision % integerPartWidth != 0)
+ significand[N-1] &=
+ (((integerPart) 1) << (Sem.precision % integerPartWidth)) - 1;
return Val;
}
OpenPOWER on IntegriCloud