aboutsummaryrefslogtreecommitdiff
path: root/winsup/mingw/mingwex/gdtoa/strtopx.c
diff options
context:
space:
mode:
authorChris Sutcliffe <ir0nh34d@users.sourceforge.net>2009-07-12 22:44:37 +0000
committerChris Sutcliffe <ir0nh34d@users.sourceforge.net>2009-07-12 22:44:37 +0000
commit15e114f5c53b0f9f009384c16d7707f7195dbe27 (patch)
treefcf56fe980f46c55d94b6f42f91671ddc046b532 /winsup/mingw/mingwex/gdtoa/strtopx.c
parent62fb43a72280b5a4f55fa5b547a887fa51de0c29 (diff)
downloadnewlib-15e114f5c53b0f9f009384c16d7707f7195dbe27.zip
newlib-15e114f5c53b0f9f009384c16d7707f7195dbe27.tar.gz
newlib-15e114f5c53b0f9f009384c16d7707f7195dbe27.tar.bz2
2009-06-28 Ozkan Sezer <sezero@users.sourceforge.net>
* mingwex/gdtoa/README.mingw mingwex/gdtoa/gdtoa_fltrnds.h: New files. * mingwex/gdtoa/README mingwex/gdtoa/dmisc.c mingwex/gdtoa/dtoa.c mingwex/gdtoa/g__fmt.c mingwex/gdtoa/g_dfmt.c mingwex/gdtoa/g_ffmt.c mingwex/gdtoa/g_xfmt.c mingwex/gdtoa/gd_arith.h mingwex/gdtoa/gd_qnan.h mingwex/gdtoa/gdtoa.c mingwex/gdtoa/gdtoa.h mingwex/gdtoa/gdtoaimp.h mingwex/gdtoa/gethex.c mingwex/gdtoa/gmisc.c mingwex/gdtoa/hd_init.c mingwex/gdtoa/hexnan.c mingwex/gdtoa/misc.c mingwex/gdtoa/qnan.c mingwex/gdtoa/smisc.c mingwex/gdtoa/strtodg.c mingwex/gdtoa/strtodnrp.c mingwex/gdtoa/strtof.c mingwex/gdtoa/strtopx.c mingwex/gdtoa/sum.c mingwex/gdtoa/ulp.c: Update the gdtoa library to match the netlib.org sources as of Apr. 20, 2009. Update further to match the sources in the mingw-w64 tree as of June 28, 2009, by removing IBM, CRAY and VAX code, removing KR_headers, ANSI, Void and Char ifdefs, renaming the double/ulong union from U to dbl_union for better grepping and white- space tidy-ups.
Diffstat (limited to 'winsup/mingw/mingwex/gdtoa/strtopx.c')
-rwxr-xr-xwinsup/mingw/mingwex/gdtoa/strtopx.c41
1 files changed, 23 insertions, 18 deletions
diff --git a/winsup/mingw/mingwex/gdtoa/strtopx.c b/winsup/mingw/mingwex/gdtoa/strtopx.c
index 59b7c22..c159196 100755
--- a/winsup/mingw/mingwex/gdtoa/strtopx.c
+++ b/winsup/mingw/mingwex/gdtoa/strtopx.c
@@ -51,20 +51,26 @@ THIS SOFTWARE.
#define _4 0
#endif
-static int
-#ifdef KR_headers
-__strtopx(s, sp, V) CONST char *s; char **sp; long double *V;
-#else
-__strtopx(CONST char *s, char **sp, long double *V)
-#endif
+typedef union lD {
+ UShort L[5];
+ long double D;
+} lD;
+
+static int __strtopx (const char *s, char **sp, lD *V)
{
- static FPI fpi = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
+ static FPI fpi0 = { 64, 1-16383-64+1, 32766 - 16383 - 64 + 1, 1, SI };
ULong bits[2];
Long exp;
int k;
- UShort *L = (UShort*)V;
+ UShort *L = & (V->L[0]);
+#ifdef Honor_FLT_ROUNDS
+#include "gdtoa_fltrnds.h"
+#else
+#define fpi &fpi0
+#endif
+ V->D = 0.0L;
- k = __strtodg(s, sp, &fpi, &exp, bits);
+ k = __strtodg(s, sp, fpi, &exp, bits);
switch(k & STRTOG_Retmask) {
case STRTOG_NoNumber:
case STRTOG_Zero:
@@ -97,23 +103,22 @@ __strtopx(CONST char *s, char **sp, long double *V)
L[2] = ldus_QNAN2;
L[3] = ldus_QNAN3;
L[4] = ldus_QNAN4;
- }
+ }
if (k & STRTOG_Neg)
L[_0] |= 0x8000;
return k;
- }
+}
-long double
-__cdecl
+long double __cdecl
__strtold (const char * __restrict__ src, char ** __restrict__ endptr)
{
- long double ret;
- __strtopx(src, endptr, &ret);
- return ret;
+ lD ret;
+ ret.D = 0.0L;
+ __strtopx(src, endptr, &ret);
+ return ret.D;
}
-long double
-__cdecl
+long double __cdecl
strtold (const char * __restrict__ src, char ** __restrict__ endptr)
__attribute__((alias("__strtold")));