softfloat: fix mask in extractFloat32Exp
PATCH 1/1 softfloat: fix mask in extractFloat32Exp
This will fix the mask of extractFloat32Exp from 0xFF to 0x7F. On bit 0x80 is the sign bit of IEEE 754.
--- fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fpu/softfloat.c +1 -1
@@ -221,7 +221,7 @@ INLINE uint32_t extractFloat32Frac( float32 a ) INLINE int_fast16_t extractFloat32Exp(float32 a) { -return (float32_val (a)>>23 ) &0xFF ; +return (float32_val (a)>>23 ) &0x7F ; }
Signature · 1 line
1.8.2
Quoted 13 lines · Alexander Aring
This will fix the mask of extractFloat32Exp from
0xFFto0x7F. On bit0x80is the sign bit of IEEE 754.Signed-off-by Alexander Aring <[email protected]>--- fpu/softfloat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fpu/softfloat.c +0
-0
fpu/softfloat.c INLINE uint32_t extractFloat32Frac( float32 a ) · line 224
Quoted 5 lines
fpu/softfloat.c +1
-1@@ -221,7 +221,7 @@ INLINE uint32_t extractFloat32Frac( float32 a ) INLINE int_fast16_t extractFloat32Exp(float32 a) { -return (float32_val (a)>>23 ) &0xFF ; +return (float32_val (a)>>23 ) &0x7F ;
This patch seems wrong because the fraction is 23 bits, exponent is 8 bits, and sign is 1 bit.
IEEE 754 Binary32 representation:
SEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFF
3 2 0
0 3
http://en.wikipedia.org/wiki/Binary32
Since the exponent is *8* bits, 0xFF is correct. The sign bit is 0x100 after >>23.
Stefan
Hi,
Quoted 9 lines · Stefan Hajnoczi
This patch seems wrong because the fraction is 23 bits, exponent is 8 bits, and sign is 1 bit.
IEEE 754 Binary32 representation:
SEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFF
3 2 0
0 3
Quoted 5 lines
http://en.wikipedia.org/wiki/Binary32
Since the exponent is *8* bits,
0xFFis correct. The sign bit is0x100after >>23.
ahh, I see it! Sorry for the noise :)
Alex