From e9c0122ec043e57f6c23577474c7afb1f8cad79b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 10 Jun 2013 15:27:43 +0000 Subject: * libc/stdlib/gdtoa-gethex.c (__hexdig): Constify. (hexdig_init): Remove. (__hexdig_fun): New function. hexdig_init, added __hexdig_fun (gethex): Call __get_hexdig macro rather than hexdig. * libc/stdlib/gdtoa-hexnan.c (hexnan): Constify fpi argument. Call __get_hexdig macro rather than hexdig. * libc/stdlib/ldtoa.c: Throughout constify functions arguments where required by constifying the following arrays. (ezero): Constify. (eone): Constify. (ermsg): Constify. (etens): Constify. (emtens): Constify. (nan113): Constify. (nan64): Constify. (nan53): Constify. (nan24): Constify. * libc/stdlib/mprec.h (__get_hexdig): Define. (gethex): Constify args in declaration where appropriate. (hexnan): Ditto. (hexdig_init): Remove declaration. (__hexdig_fun): Declare. * libc/stdlib/strtod.c (fpi): Constify. (fpinan): Constify. --- newlib/libc/stdlib/mprec.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'newlib/libc/stdlib/mprec.h') diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h index 5a71576be..d4732ca8c 100644 --- a/newlib/libc/stdlib/mprec.h +++ b/newlib/libc/stdlib/mprec.h @@ -370,9 +370,12 @@ typedef struct _Bigint _Bigint; #define gethex __gethex #define copybits __copybits #define hexnan __hexnan -#define hexdig_init __hexdig_init -#define hexdig __hexdig +#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) +#define __get_hexdig(x) __hexdig[x] /* NOTE: must evaluate arg only once */ +#else /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ +#define __get_hexdig(x) __hexdig_fun(x) +#endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ #define tens __mprec_tens #define bigtens __mprec_bigtens @@ -395,13 +398,15 @@ _Bigint * _EXFUN(d2b,(struct _reent *p, double d, int *e, int *bits)); _Bigint * _EXFUN(lshift,(struct _reent *p, _Bigint *b, int k)); _Bigint * _EXFUN(diff,(struct _reent *p, _Bigint *a, _Bigint *b)); int _EXFUN(cmp,(_Bigint *a, _Bigint *b)); -int _EXFUN(gethex,(struct _reent *p, _CONST char **sp, struct FPI *fpi, Long *exp, _Bigint **bp, int sign)); +int _EXFUN(gethex,(struct _reent *p, _CONST char **sp, _CONST struct FPI *fpi, Long *exp, _Bigint **bp, int sign)); double _EXFUN(ratio,(_Bigint *a, _Bigint *b)); __ULong _EXFUN(any_on,(_Bigint *b, int k)); void _EXFUN(copybits,(__ULong *c, int n, _Bigint *b)); -void _EXFUN(hexdig_init,(void)); +#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) */ #ifdef INFNAN_CHECK -int _EXFUN(hexnan,(_CONST char **sp, struct FPI *fpi, __ULong *x0)); +int _EXFUN(hexnan,(_CONST char **sp, _CONST struct FPI *fpi, __ULong *x0)); #endif #define Bcopy(x,y) memcpy((char *)&x->_sign, (char *)&y->_sign, y->_wds*sizeof(__Long) + 2*sizeof(int)) @@ -409,7 +414,9 @@ int _EXFUN(hexnan,(_CONST char **sp, struct FPI *fpi, __ULong *x0)); extern _CONST double tinytens[]; extern _CONST double bigtens[]; extern _CONST double tens[]; -extern unsigned char hexdig[]; +#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) +extern _CONST unsigned char __hexdig[]; +#endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ double _EXFUN(_mprec_log10,(int)); -- cgit v1.2.3