Mail Archives: djgpp-workers/2008/04/08/14:38:51
Now that _float_union_t and _float_t have been defined int ieee.h use it.
2008-04-08 Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
* src/libc/ansi/stdlib/strtold.c: Use type-punning
diff -aprNU3 djgpp.orig/src/libc/c99/stdlib/strtof.c djgpp/src/libc/c99/stdlib/strtof.c
--- djgpp.orig/src/libc/c99/stdlib/strtof.c 2008-04-08 17:55:50 +0000
+++ djgpp/src/libc/c99/stdlib/strtof.c 2008-04-08 20:15:42 +0000
@@ -73,17 +73,13 @@ strtof(const char *s, char **sret)
/* Handle NAN and NAN(<hex-number>). */
if( ! strnicmp( "NAN", s, 3 ) )
{
- union a_union
- {
- float f;
- float_t n;
- } t;
+ _float_union_t t;
- t.f = NAN;
+ t.f = NAN;
if( sign < 0 )
{
- t.n.sign = 1;
+ t.ft.sign = 1;
}
if( s[3] == '(' )
@@ -97,7 +93,7 @@ strtof(const char *s, char **sret)
mantissa_bits = mantissa_bits & 0x7fffff;
if( mantissa_bits )
{
- t.n.mantissa = mantissa_bits;
+ t.ft.mantissa = mantissa_bits;
}
if( sret )
{
@@ -114,7 +110,7 @@ strtof(const char *s, char **sret)
{
*sret = unconst((&s[3]), char *);
}
- return (t.f);
+ return (t.f);
}
/* Handle ordinary numbers. */
- Raw text -