return fs;
int parts = partCount();
- integerPart *x = new integerPart[parts];
+ auto XOwner = make_unique<integerPart[]>(parts);
+ auto x = XOwner.get();
bool ignored;
fs = V.convertToInteger(x, parts * integerPartWidth, true,
rmNearestTiesToEven, &ignored);
if (isZero())
sign = origSign; // IEEE754 requires this
- delete[] x;
return fs;
}
return fs;
int parts = partCount();
- integerPart *x = new integerPart[parts];
+ auto XOwner = make_unique<integerPart[]>(parts);
+ auto x = XOwner.get();
bool ignored;
fs = V.convertToInteger(x, parts * integerPartWidth, true,
rmTowardZero, &ignored);
if (isZero())
sign = origSign; // IEEE754 requires this
- delete[] x;
}
return fs;
}
if (isSigned &&
APInt::tcExtractBit(src, srcCount * integerPartWidth - 1)) {
- integerPart *copy;
+ auto C = make_unique<integerPart[]>(srcCount);
+ auto copy = C.get();
/* 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);
/* 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
tcMultiplyPart. */
partCount = static_cast<unsigned int>(D.lastSigDigit - D.firstSigDigit) + 1;
partCount = partCountForBits(1 + 196 * partCount / 59);
- decSignificand = new integerPart[partCount + 1];
+ auto DecSignificandOwner = make_unique<integerPart[]>(partCount + 1);
+ auto decSignificand = DecSignificandOwner.get();
partCount = 0;
/* Convert to binary efficiently - we do almost all multiplication
category = fcNormal;
fs = roundSignificandWithExponent(decSignificand, partCount,
D.exponent, rounding_mode);
-
- delete [] decSignificand;
}
return fs;