From: epetrich Date: Tue, 31 Aug 2004 04:19:16 +0000 (+0000) Subject: * device/lib/acosf.c (acosf), X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=f42d37bc960a8ad533003fcad5b70539e818887e;p=fw%2Fsdcc * device/lib/acosf.c (acosf), * device/lib/asinf.c (asinf), * device/lib/atanf.c (atanf), * device/lib/ceilf.c (ceilf), * device/lib/cosf.c (cosf), * device/lib/coshf.c (coshf), * device/lib/cotf.c (cotf), * device/lib/fabsf.c (fabsf), * device/lib/floorf.c (floorf), * device/lib/log10f.c (log10f), * device/lib/logf.c (logf), * device/lib/sinf.c (sinf), * device/lib/sinhf.c (sinhf), * device/lib/sqrtf.c (sqrtf), * device/lib/tanf.c (tanf), * device/lib/tanhf.c (tanhf), * device/include/math.h: defined _FLOAT_FUNC_REENTRANT macro and replaced all instances of "reentrant" in the library functions defined in math.h with this macro. * support/regression/tests/float_trans.c: reenabled test for hc08 git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3465 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 2ca73001..32bd6227 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2004-08-30 Erik Petrich + + * device/lib/acosf.c (acosf), + * device/lib/asinf.c (asinf), + * device/lib/atanf.c (atanf), + * device/lib/ceilf.c (ceilf), + * device/lib/cosf.c (cosf), + * device/lib/coshf.c (coshf), + * device/lib/cotf.c (cotf), + * device/lib/fabsf.c (fabsf), + * device/lib/floorf.c (floorf), + * device/lib/log10f.c (log10f), + * device/lib/logf.c (logf), + * device/lib/sinf.c (sinf), + * device/lib/sinhf.c (sinhf), + * device/lib/sqrtf.c (sqrtf), + * device/lib/tanf.c (tanf), + * device/lib/tanhf.c (tanhf), + * device/include/math.h: defined _FLOAT_FUNC_REENTRANT macro and + replaced all instances of "reentrant" in the library functions + defined in math.h with this macro. + * support/regression/tests/float_trans.c: reenabled test for hc08 + 2004-08-30 Bernhard Held * device/lib/pic16/Makefile.common.in: added MODELFLAGS again, it was diff --git a/device/include/math.h b/device/include/math.h index 326ab00e..ce084d03 100644 --- a/device/include/math.h +++ b/device/include/math.h @@ -42,38 +42,46 @@ union float_long long l; }; +/* Functions on the z80 & gbz80 are always reentrant and so the "reentrant" */ +/* keyword is not defined. */ +#if defined(SDCC_z80) || defined(SDCC_gbz80) +#define _FLOAT_FUNC_REENTRANT +#else +#define _FLOAT_FUNC_REENTRANT reentrant +#endif + /********************************************** * Prototypes for float ANSI C math functions * **********************************************/ /* Trigonometric functions */ -float sinf(const float x); -float cosf(const float x); -float tanf(const float x); -float cotf(const float x); -float asinf(const float x); -float acosf(const float x); -float atanf(const float x); +float sinf(const float x) _FLOAT_FUNC_REENTRANT; +float cosf(const float x) _FLOAT_FUNC_REENTRANT; +float tanf(const float x) _FLOAT_FUNC_REENTRANT; +float cotf(const float x) _FLOAT_FUNC_REENTRANT; +float asinf(const float x) _FLOAT_FUNC_REENTRANT; +float acosf(const float x) _FLOAT_FUNC_REENTRANT; +float atanf(const float x) _FLOAT_FUNC_REENTRANT; float atan2f(const float x, const float y); /* Hyperbolic functions */ -float sinhf(const float x); -float coshf(const float x); -float tanhf(const float x); +float sinhf(const float x) _FLOAT_FUNC_REENTRANT; +float coshf(const float x) _FLOAT_FUNC_REENTRANT; +float tanhf(const float x) _FLOAT_FUNC_REENTRANT; /* Exponential, logarithmic and power functions */ float expf(const float x); -float logf(const float x); -float log10f(const float x); +float logf(const float x) _FLOAT_FUNC_REENTRANT; +float log10f(const float x) _FLOAT_FUNC_REENTRANT; float powf(const float x, const float y); -float sqrtf(const float a); +float sqrtf(const float a) _FLOAT_FUNC_REENTRANT; /* Nearest integer, absolute value, and remainder functions */ -float fabsf(const float x); +float fabsf(const float x) _FLOAT_FUNC_REENTRANT; float frexpf(const float x, int *pw2); float ldexpf(const float x, const int pw2); -float ceilf(float x); -float floorf(float x); +float ceilf(float x) _FLOAT_FUNC_REENTRANT; +float floorf(float x) _FLOAT_FUNC_REENTRANT; float modff(float x, float * y); #endif /* _INC_MATH */ diff --git a/device/lib/acosf.c b/device/lib/acosf.c index 110ffa40..fa86e135 100644 --- a/device/lib/acosf.c +++ b/device/lib/acosf.c @@ -22,7 +22,7 @@ float asincosf(const float x, const int isacos); -float acosf(const float x) reentrant +float acosf(const float x) _FLOAT_FUNC_REENTRANT { if(x== 1.0) return 0.0; else if(x==-1.0) return PI; diff --git a/device/lib/asinf.c b/device/lib/asinf.c index 29291364..0d5b1523 100644 --- a/device/lib/asinf.c +++ b/device/lib/asinf.c @@ -22,7 +22,7 @@ float asincosf(const float x, const int isacos); -float asinf(const float x) reentrant +float asinf(const float x) _FLOAT_FUNC_REENTRANT { if(x== 1.0) return HALF_PI; else if(x==-1.0) return -HALF_PI; diff --git a/device/lib/atanf.c b/device/lib/atanf.c index ed70035c..135c3f90 100644 --- a/device/lib/atanf.c +++ b/device/lib/atanf.c @@ -42,7 +42,7 @@ #define myconst const #endif -float atanf(const float x) reentrant +float atanf(const float x) _FLOAT_FUNC_REENTRANT { float f, r, g; int n=0; diff --git a/device/lib/ceilf.c b/device/lib/ceilf.c index f3599f8a..54b7c0fe 100644 --- a/device/lib/ceilf.c +++ b/device/lib/ceilf.c @@ -20,7 +20,7 @@ #include -float ceilf(float x) reentrant +float ceilf(float x) _FLOAT_FUNC_REENTRANT { long r; r=x; diff --git a/device/lib/cosf.c b/device/lib/cosf.c index 9335a314..57f430c5 100644 --- a/device/lib/cosf.c +++ b/device/lib/cosf.c @@ -22,7 +22,7 @@ float sincosf(const float x, const int iscos); -float cosf(const float x) reentrant +float cosf(const float x) _FLOAT_FUNC_REENTRANT { if (x==0.0) return 1.0; return sincosf(x, 1); diff --git a/device/lib/coshf.c b/device/lib/coshf.c index 3a12eda8..3e8257e9 100644 --- a/device/lib/coshf.c +++ b/device/lib/coshf.c @@ -22,7 +22,7 @@ float sincoshf(const float x, const int iscosh); -float coshf(const float x) reentrant +float coshf(const float x) _FLOAT_FUNC_REENTRANT { return sincoshf(x, 1); } diff --git a/device/lib/cotf.c b/device/lib/cotf.c index 9e8329a5..03886c12 100644 --- a/device/lib/cotf.c +++ b/device/lib/cotf.c @@ -23,7 +23,7 @@ float tancotf(const float x, const int iscot); -float cotf(const float x) reentrant +float cotf(const float x) _FLOAT_FUNC_REENTRANT { float y; diff --git a/device/lib/fabsf.c b/device/lib/fabsf.c index 827a99a1..4a061d17 100644 --- a/device/lib/fabsf.c +++ b/device/lib/fabsf.c @@ -21,7 +21,7 @@ #include #include -float fabsf(const float x) reentrant +float fabsf(const float x) _FLOAT_FUNC_REENTRANT { union float_long fl; diff --git a/device/lib/floorf.c b/device/lib/floorf.c index b0f474f3..f12adae1 100644 --- a/device/lib/floorf.c +++ b/device/lib/floorf.c @@ -20,7 +20,7 @@ #include -float floorf (float x) reentrant +float floorf (float x) _FLOAT_FUNC_REENTRANT { long r; r=x; diff --git a/device/lib/log10f.c b/device/lib/log10f.c index 13f77cda..8a564bb6 100644 --- a/device/lib/log10f.c +++ b/device/lib/log10f.c @@ -21,7 +21,7 @@ #include #include -float log10f(const float x) reentrant +float log10f(const float x) _FLOAT_FUNC_REENTRANT { return logf(x)*0.4342944819; } diff --git a/device/lib/logf.c b/device/lib/logf.c index c89778c7..75c3f71b 100644 --- a/device/lib/logf.c +++ b/device/lib/logf.c @@ -34,7 +34,7 @@ #define C1 0.693359375 /*355.0/512.0*/ #define C2 -2.121944400546905827679E-4 -float logf(const float x) reentrant +float logf(const float x) _FLOAT_FUNC_REENTRANT { #if defined(SDCC_mcs51) && defined(SDCC_MODEL_SMALL) \ && !defined(SDCC_NOOVERLAY) diff --git a/device/lib/sinf.c b/device/lib/sinf.c index 63585710..50458a34 100644 --- a/device/lib/sinf.c +++ b/device/lib/sinf.c @@ -22,7 +22,7 @@ float sincosf(const float x, const int iscos); -float sinf(const float x) reentrant +float sinf(const float x) _FLOAT_FUNC_REENTRANT { if (x==0.0) return 0.0; return sincosf(x, 0); diff --git a/device/lib/sinhf.c b/device/lib/sinhf.c index 3741d401..81c2bb71 100644 --- a/device/lib/sinhf.c +++ b/device/lib/sinhf.c @@ -22,7 +22,7 @@ float sincoshf(const float x, const int iscosh); -float sinhf(const float x) reentrant +float sinhf(const float x) _FLOAT_FUNC_REENTRANT { return sincoshf(x, 0); } diff --git a/device/lib/sqrtf.c b/device/lib/sqrtf.c index 477d535a..740fac79 100644 --- a/device/lib/sqrtf.c +++ b/device/lib/sqrtf.c @@ -24,7 +24,7 @@ #include #include -float sqrtf(const float x) reentrant +float sqrtf(const float x) _FLOAT_FUNC_REENTRANT { float f, y; int n; diff --git a/device/lib/tanf.c b/device/lib/tanf.c index 48c18bff..2ba74008 100644 --- a/device/lib/tanf.c +++ b/device/lib/tanf.c @@ -22,7 +22,7 @@ float tancotf(const float x, const int iscot); -float tanf(const float x) reentrant +float tanf(const float x) _FLOAT_FUNC_REENTRANT { return tancotf(x, 0); } diff --git a/device/lib/tanhf.c b/device/lib/tanhf.c index 5737c001..9fc7e530 100644 --- a/device/lib/tanhf.c +++ b/device/lib/tanhf.c @@ -37,7 +37,7 @@ #define P(g) ((P1*g+P0)*g) #define Q(g) (Q1*g+Q0) -float tanhf(const float x) reentrant +float tanhf(const float x) _FLOAT_FUNC_REENTRANT { float f, g, r; diff --git a/support/regression/tests/float_trans.c b/support/regression/tests/float_trans.c index a6dbb158..6431baf6 100644 --- a/support/regression/tests/float_trans.c +++ b/support/regression/tests/float_trans.c @@ -11,7 +11,7 @@ void testTrans(void) { -#if !defined(SDCC_z80) && !defined(SDCC_hc08) && !PORT_HOST +#if !defined(SDCC_z80) && !PORT_HOST # ifdef SQRTF ASSERT(fabsf (sqrtf (5.0) - 2.23606801) < 0.00001); # endif