From fbace81684f8cbb80a2048c01dc545af247f5cb7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 20 Nov 2015 18:14:58 +0100 Subject: Import correctly working strtold from David M. Gay. * libc/stdlib/Makefile.am (GENERAL_SOURCES): Add strtodg.c and strtorx.c. * libc/stdlib/Makefile.in: Regenerate. * libc/stdlib/strtodg.c: New file implementing generic string to long double conversion. * libc/stdlib/strtorx.c: New file, implementing IEEE format string to long double conversion. * libc/stdlib/mprec.h (_strtodg_r): Declare. (_strtorx_r): Declare. * libc/stdlib/gdtoa.h (__UShort): Define. * libc/stdlib/strtold.c (__flt_rounds): Define for i386 and x86_64 target. (FLT_ROUNDS): Define, as 0 on platforms missing a __flt_rounds function. (_strtold_r): Converted from strtold. Call _strtorx_r on targets supporting distinct long doubles. (strtold): Just call _strtold_r. * libc/include/stdlib.h (_strtold_r): Declare. * libc/stdlib/ldtoa.c (_strtold): Comment out. Explain why. * libc/stdio/vfscanf.c (__SVFSCANF_R): Call _strtold_r instead of _strtold. * libc/machine/powerpc/vfscanf.c (__svfscanf_r): Ditto. * common.din (strtold): Drop redirection to _strtold. Signed-off-by: Corinna Vinschen --- newlib/libc/stdlib/mprec.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'newlib/libc/stdlib/mprec.h') diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h index 8472e7db0..afda63e73 100644 --- a/newlib/libc/stdlib/mprec.h +++ b/newlib/libc/stdlib/mprec.h @@ -404,6 +404,11 @@ int _EXFUN(gethex,(struct _reent *p, _CONST char **sp, _CONST struct FPI *fpi, double _EXFUN(ratio,(_Bigint *a, _Bigint *b)); __ULong _EXFUN(any_on,(_Bigint *b, int k)); void _EXFUN(copybits,(__ULong *c, int n, _Bigint *b)); +#if defined (_HAVE_LONG_DOUBLE) && !defined (_LDBL_EQ_DBL) +int _EXFUN(_strtorx_r,(struct _reent *, _CONST char *, char **, int, void *)); +int _EXFUN(_strtodg_r,(struct _reent *p, _CONST char *s00, char **se, struct FPI *fpi, Long *exp, __ULong *bits)); +#endif /* _HAVE_LONG_DOUBLE && !_LDBL_EQ_DBL */ + #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) || defined(_SMALL_HEXDIG) unsigned char _EXFUN(__hexdig_fun,(unsigned char)); #endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ -- cgit v1.2.3