Simplify and fix signed int -> FP conversions.
authorDale Johannesen <dalej@apple.com>
Sun, 30 Sep 2007 18:17:01 +0000 (18:17 +0000)
committerDale Johannesen <dalej@apple.com>
Sun, 30 Sep 2007 18:17:01 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42483 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APFloat.cpp

index 278e546d8a34f76a0af8e94d0df6a4040c06eaa1..8e1580bd4a70998406a1a2acd691ebee201b69f3 100644 (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);