X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f X-Recipient: djgpp-workers AT delorie DOT com X-Authenticated: #27081556 X-Provags-ID: V01U2FsdGVkX1+8uHMpIw68EANXyvki+fylqsBFWXHl1EVNUdXyML 3ICdC4x5VxyhoS From: Juan Manuel Guerrero To: djgpp-workers AT delorie DOT com Subject: type-punning for strtof Date: Tue, 8 Apr 2008 20:38:37 +0200 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200804082038.38769.juan.guerrero@gmx.de> X-Y-GMX-Trusted: 0 Reply-To: djgpp-workers AT delorie DOT com Now that _float_union_t and _float_t have been defined int ieee.h use it. 2008-04-08 Juan Manuel Guerrero * 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(). */ 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. */