[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_n
From: |
Peter Maydell |
Subject: |
[Qemu-devel] Re: [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan() |
Date: |
Wed, 12 Jan 2011 15:05:10 -0600 |
On 12 January 2011 13:59, Aurelien Jarno <address@hidden> wrote:
> @@ -494,7 +495,8 @@ int floatx80_is_quiet_nan( floatx80 a )
> int floatx80_is_signaling_nan( floatx80 a )
> {
> #if SNAN_BIT_IS_ONE
> - return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
> + return ( ( a.high & 0x7FFF ) == 0x7FFF )
> + && (LIT64( 0x8000000000000000 ) >= ((bits64) ( a.low<<1 )));
> #else
> bits64 aLow;
If a is {0x7ffff,0} (ie +inf) this will return true, which is wrong.
Do you want "<=" instead?
Actually, will
return ((a.high & 0x7fff) == 0x7fff) && (a.low >= LIT64(0x4000000000000000));
do? Untested but I think it will do the right thing. I'm not sure
why this code has those bit64 casts, incidentally, since a.low is
already a uint64_t.
Also, maybe we should have a comment somewhere explaining
why this is different from the other NaN functions (ie that the
x80 format has an explicit bit and the others don't) ?
-- PMM