summaryrefslogtreecommitdiff
path: root/lib/libc/softfloat/bits64/softfloat.c
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2013-11-22 17:04:24 +0000
committermartin <martin@NetBSD.org>2013-11-22 17:04:24 +0000
commit06b1743b60c05e076dc607e3706b38130133792a (patch)
tree59d2478c5c78ca4b7a2eff4ce9d5d26a10ac88fd /lib/libc/softfloat/bits64/softfloat.c
parent9df472dc3ec008bad10da6c70cea10164240aa4d (diff)
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 (limited to 'lib/libc/softfloat/bits64/softfloat.c')
-rw-r--r--lib/libc/softfloat/bits64/softfloat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/softfloat/bits64/softfloat.c b/lib/libc/softfloat/bits64/softfloat.c
index 2eb7f91bac7..aed0c6ab12d 100644
--- a/lib/libc/softfloat/bits64/softfloat.c
+++ b/lib/libc/softfloat/bits64/softfloat.c
@@ -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 @@ this code that are retained.
#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 @@ float128 float128_sqrt( float128 a )
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 );