Simplify and fix signed int -> FP conversions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42483 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2007-09-30 18:17:01 +00:00
parent cd8bc05102
commit cce23a4c35

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);