5544c1b
From 41e7a1710ee9787900713a769b7d07677857260a Mon Sep 17 00:00:00 2001
5544c1b
From: Peter Maydell <peter.maydell@linaro.org>
5544c1b
Date: Fri, 28 Sep 2012 16:17:03 +0100
5544c1b
Subject: [PATCH] fpu/softfloat.c: Return correctly signed values from
5544c1b
 uint64_to_float32
5544c1b
5544c1b
The uint64_to_float32() conversion function was incorrectly always
5544c1b
returning numbers with the sign bit set (ie negative numbers). Correct
5544c1b
this so we return positive numbers instead.
5544c1b
5544c1b
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5544c1b
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
5544c1b
(cherry picked from commit e744c06fca438dc08271e626034e632a270c91c8)
5544c1b
5544c1b
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
5544c1b
---
5544c1b
 fpu/softfloat.c | 4 ++--
5544c1b
 1 file changed, 2 insertions(+), 2 deletions(-)
5544c1b
5544c1b
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
5544c1b
index b29256a..91497e8 100644
5544c1b
--- a/fpu/softfloat.c
5544c1b
+++ b/fpu/softfloat.c
5544c1b
@@ -1238,7 +1238,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM )
5544c1b
     if ( a == 0 ) return float32_zero;
5544c1b
     shiftCount = countLeadingZeros64( a ) - 40;
5544c1b
     if ( 0 <= shiftCount ) {
5544c1b
-        return packFloat32( 1 > 0, 0x95 - shiftCount, a<
5544c1b
+        return packFloat32(0, 0x95 - shiftCount, a<
5544c1b
     }
5544c1b
     else {
5544c1b
         shiftCount += 7;
5544c1b
@@ -1248,7 +1248,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM )
5544c1b
         else {
5544c1b
             a <<= shiftCount;
5544c1b
         }
5544c1b
-        return roundAndPackFloat32( 1 > 0, 0x9C - shiftCount, a STATUS_VAR );
5544c1b
+        return roundAndPackFloat32(0, 0x9C - shiftCount, a STATUS_VAR);
5544c1b
     }
5544c1b
 }
5544c1b