Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/softfloat/bits64 Fix a cast from the lint cleanup t...



details:   https://anonhg.NetBSD.org/src/rev/17c7ef448211
branches:  trunk
changeset: 791535:17c7ef448211
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Nov 22 17:04:24 2013 +0000

description:
Fix a cast from the lint cleanup that made small exponents (i.e. values < 1)
sign extend wrong and overflow, causing an underflow in all 128 bit sqrt
calculations.

diffstat:

 lib/libc/softfloat/bits64/softfloat.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 594f99b3060e -r 17c7ef448211 lib/libc/softfloat/bits64/softfloat.c
--- a/lib/libc/softfloat/bits64/softfloat.c     Fri Nov 22 16:26:52 2013 +0000
+++ b/lib/libc/softfloat/bits64/softfloat.c     Fri Nov 22 17:04:24 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: softfloat.c,v 1.12 2013/01/10 08:16:11 matt Exp $ */
+/* $NetBSD: softfloat.c,v 1.13 2013/11/22 17:04:24 martin Exp $ */
 
 /*
  * This version hacked for use with gcc -msoft-float by bjh21.
@@ -46,7 +46,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: softfloat.c,v 1.12 2013/01/10 08:16:11 matt Exp $");
+__RCSID("$NetBSD: softfloat.c,v 1.13 2013/11/22 17:04:24 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef SOFTFLOAT_FOR_GCC
@@ -5261,7 +5261,7 @@
         if ( ( aSig0 | aSig1 ) == 0 ) return packFloat128( 0, 0, 0, 0 );
         normalizeFloat128Subnormal( aSig0, aSig1, &aExp, &aSig0, &aSig1 );
     }
-    zExp = ( (unsigned int)(aExp - 0x3FFF) >> 1) + 0x3FFE;
+    zExp = (int32) ( (aExp - 0x3FFF) >> 1) + 0x3FFE;
     aSig0 |= LIT64( 0x0001000000000000 );
     zSig0 = estimateSqrt32((int16)aExp, (bits32)(aSig0>>17));
     shortShift128Left( aSig0, aSig1, 13 - ( aExp & 1 ), &aSig0, &aSig1 );



Home | Main Index | Thread Index | Old Index