]> git.proxmox.com Git - qemu.git/commitdiff
fpu/softfloat.c: Return correctly signed values from uint64_to_float32
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 28 Sep 2012 15:17:03 +0000 (16:17 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Mon, 1 Oct 2012 20:06:39 +0000 (22:06 +0200)
The uint64_to_float32() conversion function was incorrectly always
returning numbers with the sign bit set (ie negative numbers). Correct
this so we return positive numbers instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
fpu/softfloat.c

index 01a28cab1a88656da070c14a7a127f675513b2fa..841314686b4b6ac0d5ce7710c4cfe9f9b342026a 100644 (file)
@@ -1238,7 +1238,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM )
     if ( a == 0 ) return float32_zero;
     shiftCount = countLeadingZeros64( a ) - 40;
     if ( 0 <= shiftCount ) {
-        return packFloat32( 1 > 0, 0x95 - shiftCount, a<<shiftCount );
+        return packFloat32(0, 0x95 - shiftCount, a<<shiftCount);
     }
     else {
         shiftCount += 7;
@@ -1248,7 +1248,7 @@ float32 uint64_to_float32( uint64 a STATUS_PARAM )
         else {
             a <<= shiftCount;
         }
-        return roundAndPackFloat32( 1 > 0, 0x9C - shiftCount, a STATUS_VAR );
+        return roundAndPackFloat32(0, 0x9C - shiftCount, a STATUS_VAR);
     }
 }