From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=33911 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdHet-0001dI-Ag for qemu-devel@nongnu.org; Thu, 13 Jan 2011 02:31:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdHes-0001du-0K for qemu-devel@nongnu.org; Thu, 13 Jan 2011 02:31:47 -0500 Received: from hall.aurel32.net ([88.191.126.93]:33109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdHer-0001dj-Q0 for qemu-devel@nongnu.org; Thu, 13 Jan 2011 02:31:45 -0500 Date: Thu, 13 Jan 2011 08:31:42 +0100 From: Aurelien Jarno Message-ID: <20110113073142.GA25117@ohm.aurel32.net> References: <1294862379-31353-1-git-send-email-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: [Qemu-devel] Re: [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org On Wed, Jan 12, 2011 at 03:05:10PM -0600, Peter Maydell wrote: > On 12 January 2011 13:59, Aurelien Jarno 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? Correct, I swapped the operands at the last minute to match the other functions, but without changing the sign. > 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 The explicit bit might be one for a NaN, so you should filter it first. > why this code has those bit64 casts, incidentally, since a.low is > already a uint64_t. Don't know either, but as they were already there, I left them. > 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) ? > Good idea, will do. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net