Simplify and fix signed int -> FP conversions.

llvm-svn: 42483
This commit is contained in:
Dale Johannesen 2007-09-30 18:17:01 +00:00
parent 9b5a117d01
commit 4b203b8e44

View File

@ -1519,17 +1519,9 @@ APFloat::convertFromInteger(const integerPart *parts, unsigned int width,
integerPart *copy = new integerPart[partCount];
sign = false;
if(isSigned) {
if (APInt::tcExtractBit(parts, width - 1)) {
sign = true;
if (width < partCount * integerPartWidth)
api = api.sext(partCount * integerPartWidth);
}
else if (width < partCount * integerPartWidth)
api = api.zext(partCount * integerPartWidth);
} else {
if (width < partCount * integerPartWidth)
api = api.zext(partCount * integerPartWidth);
if(isSigned && APInt::tcExtractBit(parts, width - 1)) {
sign = true;
api = -api;
}
APInt::tcAssign(copy, api.getRawData(), partCount);