aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/mprec.h
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-06-10 15:27:43 +0000
committerCorinna Vinschen <corinna@vinschen.de>2013-06-10 15:27:43 +0000
commite9c0122ec043e57f6c23577474c7afb1f8cad79b (patch)
treeb9c99dd0f525fe9344c07dc117953816217100a1 /newlib/libc/stdlib/mprec.h
parentd7e4267f4531815b7fc60d89ee049ae14b0d7cf7 (diff)
downloadnewlib-e9c0122ec043e57f6c23577474c7afb1f8cad79b.zip
newlib-e9c0122ec043e57f6c23577474c7afb1f8cad79b.tar.gz
newlib-e9c0122ec043e57f6c23577474c7afb1f8cad79b.tar.bz2
* 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.
Diffstat (limited to 'newlib/libc/stdlib/mprec.h')
-rw-r--r--newlib/libc/stdlib/mprec.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h
index 5a71576..d4732ca 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));