summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APFloat.cpp
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2007-10-06 00:24:48 +0000
committerNeil Booth <neil@daikokuya.co.uk>2007-10-06 00:24:48 +0000
commit0ea72a9a91c806471cdbea7064ecb5b2f182cd69 (patch)
treee7d17545cd3791cdb29634856bab61e4fefcf6de /llvm/lib/Support/APFloat.cpp
parent1d0d24c4fd9e42fc2d8e1ba15c2c06edf810fc81 (diff)
downloadbcm5719-llvm-0ea72a9a91c806471cdbea7064ecb5b2f182cd69.tar.gz
bcm5719-llvm-0ea72a9a91c806471cdbea7064ecb5b2f182cd69.zip
Generalize tcFullMultiply so that the operands can be of differing
part widths. Also, return the number of parts actually required to hold the result's value. Remove an over-cautious condition from rounding of float->hex conversion. llvm-svn: 42669
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r--llvm/lib/Support/APFloat.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp
index 3746ae8cfef..34784a0468e 100644
--- a/llvm/lib/Support/APFloat.cpp
+++ b/llvm/lib/Support/APFloat.cpp
@@ -519,7 +519,7 @@ APFloat::multiplySignificand(const APFloat &rhs, const APFloat *addend)
partsCount = partCount();
APInt::tcFullMultiply(fullSignificand, lhsSignificand,
- rhs.significandParts(), partsCount);
+ rhs.significandParts(), partsCount, partsCount);
lost_fraction = lfExactlyZero;
omsb = APInt::tcMSB(fullSignificand, newPartsCount) + 1;
@@ -1795,7 +1795,7 @@ APFloat::convertNormalToHexString(char *dst, unsigned int hexDigits,
/* hexDigits of zero means use the required number for the
precision. Otherwise, see if we are truncating. If we are,
- found out if we need to round away from zero. */
+ find out if we need to round away from zero. */
if (hexDigits) {
if (hexDigits < outputDigits) {
/* We are dropping non-zero bits, so need to check how to round.
@@ -1845,7 +1845,8 @@ APFloat::convertNormalToHexString(char *dst, unsigned int hexDigits,
do {
q--;
*q = hexDigitChars[hexDigitValue (*q) + 1];
- } while (*q == '0' && q > p);
+ } while (*q == '0');
+ assert (q >= p);
} else {
/* Add trailing zeroes. */
memset (dst, '0', outputDigits);
OpenPOWER on IntegriCloud