[llvm-commits] [llvm] r42483 - /llvm/trunk/lib/Support/APFloat.cpp

Dale Johannesen dalej at apple.com
Sun Sep 30 11:17:02 PDT 2007


Author: johannes
Date: Sun Sep 30 13:17:01 2007
New Revision: 42483

URL: http://llvm.org/viewvc/llvm-project?rev=42483&view=rev
Log:
Simplify and fix signed int -> FP conversions.


Modified:
    llvm/trunk/lib/Support/APFloat.cpp

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=42483&r1=42482&r2=42483&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Sun Sep 30 13:17:01 2007
@@ -1519,17 +1519,9 @@
   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);





More information about the llvm-commits mailing list