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