diff options
author | Dylan Noblesmith <nobled@dreamwidth.org> | 2014-08-26 02:03:33 +0000 |
---|---|---|
committer | Dylan Noblesmith <nobled@dreamwidth.org> | 2014-08-26 02:03:33 +0000 |
commit | 4e69e29a72a1ffcbf755f13ed909b51cfbcafd60 (patch) | |
tree | fdd637c174c9a3baec633c9b61174059e21fd36c /llvm/lib/Support/APFloat.cpp | |
parent | 42836d95e0766d6bce81c7124173fe9137bb0da7 (diff) | |
download | bcm5719-llvm-4e69e29a72a1ffcbf755f13ed909b51cfbcafd60.tar.gz bcm5719-llvm-4e69e29a72a1ffcbf755f13ed909b51cfbcafd60.zip |
Revert "Support/APFloat: unique_ptr-ify temp arrays"
This reverts commit rr216359.
llvm-svn: 216429
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 4359061e433..7989e30afae 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -1722,8 +1722,7 @@ APFloat::remainder(const APFloat &rhs) return fs; int parts = partCount(); - auto XOwner = make_unique<integerPart[]>(parts); - auto x = XOwner.get(); + integerPart *x = new integerPart[parts]; bool ignored; fs = V.convertToInteger(x, parts * integerPartWidth, true, rmNearestTiesToEven, &ignored); @@ -1742,6 +1741,7 @@ APFloat::remainder(const APFloat &rhs) if (isZero()) sign = origSign; // IEEE754 requires this + delete[] x; return fs; } @@ -1762,8 +1762,7 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode) return fs; int parts = partCount(); - auto XOwner = make_unique<integerPart[]>(parts); - auto x = XOwner.get(); + integerPart *x = new integerPart[parts]; bool ignored; fs = V.convertToInteger(x, parts * integerPartWidth, true, rmTowardZero, &ignored); @@ -1782,6 +1781,7 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode) if (isZero()) sign = origSign; // IEEE754 requires this + delete[] x; } return fs; } @@ -2284,14 +2284,15 @@ APFloat::convertFromSignExtendedInteger(const integerPart *src, if (isSigned && APInt::tcExtractBit(src, srcCount * integerPartWidth - 1)) { - auto C = make_unique<integerPart[]>(srcCount); - auto copy = C.get(); + integerPart *copy; /* If we're signed and negative negate a copy. */ sign = true; + copy = new integerPart[srcCount]; APInt::tcAssign(copy, src, srcCount); APInt::tcNegate(copy, srcCount); status = convertFromUnsignedParts(copy, srcCount, rounding_mode); + delete [] copy; } else { sign = false; status = convertFromUnsignedParts(src, srcCount, rounding_mode); @@ -2544,6 +2545,7 @@ APFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode) /* Overflow and round. */ fs = handleOverflow(rounding_mode); } else { + integerPart *decSignificand; unsigned int partCount; /* A tight upper bound on number of bits required to hold an @@ -2552,8 +2554,7 @@ APFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode) tcMultiplyPart. */ partCount = static_cast<unsigned int>(D.lastSigDigit - D.firstSigDigit) + 1; partCount = partCountForBits(1 + 196 * partCount / 59); - auto DecSignificandOwner = make_unique<integerPart[]>(partCount + 1); - auto decSignificand = DecSignificandOwner.get(); + decSignificand = new integerPart[partCount + 1]; partCount = 0; /* Convert to binary efficiently - we do almost all multiplication @@ -2594,6 +2595,8 @@ APFloat::convertFromDecimalString(StringRef str, roundingMode rounding_mode) category = fcNormal; fs = roundSignificandWithExponent(decSignificand, partCount, D.exponent, rounding_mode); + + delete [] decSignificand; } return fs; |