mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-26 08:00:09 +08:00
Minimum changes to make all float variants of math.h functions work,
by calling the double functions and removing unsupported __asm implementations using "=t". This patch also enables the double version of logb(double). Note: None of the 'long double' variants works though - could easily be fixed by aliasing the double equvalents for completeness/compability.
This commit is contained in:
parent
c386ca91c6
commit
df67d8617b
@ -198,12 +198,6 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
__CRT_INLINE long double __cdecl fabsl (long double x)
|
|
||||||
{
|
|
||||||
long double res;
|
|
||||||
__asm__ ("fabs;" : "=t" (res) : "0" (x));
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y)))
|
#define _hypotl(x,y) ((long double)_hypot((double)(x),(double)(y)))
|
||||||
#define _matherrl _matherr
|
#define _matherrl _matherr
|
||||||
__CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); }
|
__CRT_INLINE long double _chgsignl(long double _Number) { return _chgsign((double)(_Number)); }
|
||||||
@ -211,14 +205,31 @@ extern "C" {
|
|||||||
__CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
|
__CRT_INLINE float frexpf(float _X,int *_Y) { return ((float)frexp((double)_X,_Y)); }
|
||||||
|
|
||||||
#if !defined (__ia64__)
|
#if !defined (__ia64__)
|
||||||
__CRT_INLINE float __cdecl fabsf (float x)
|
__CRT_INLINE float fabsf(float x) { return (float) fabs(x); }
|
||||||
{
|
__CRT_INLINE float ldexpf(float x, int expn) { return (float) ldexp(x, expn); }
|
||||||
float res;
|
__CRT_INLINE float acosf(float x) { return (float) acos(x); }
|
||||||
__asm__ ("fabs;" : "=t" (res) : "0" (x));
|
__CRT_INLINE float asinf(float x) { return (float) asin(x); }
|
||||||
return res;
|
__CRT_INLINE float atanf(float x) { return (float) atan(x); }
|
||||||
|
__CRT_INLINE float atan2f(float x, float y) { return (float) atan2(x, y); }
|
||||||
|
__CRT_INLINE float ceilf(float x) { return (float) ceil(x); }
|
||||||
|
__CRT_INLINE float cosf(float x) { return (float) cos(x); }
|
||||||
|
__CRT_INLINE float coshf(float x) { return (float) cosh(x); }
|
||||||
|
__CRT_INLINE float expf(float x) { return (float) exp(x); }
|
||||||
|
__CRT_INLINE float floorf(float x) { return (float) floor(x); }
|
||||||
|
__CRT_INLINE float fmodf(float x, float y) { return (float) fmod(x, y); }
|
||||||
|
__CRT_INLINE float logf(float x) { return (float) log(x); }
|
||||||
|
__CRT_INLINE float logbf(float x) { return (float) logb(x); }
|
||||||
|
__CRT_INLINE float log10f(float x) { return (float) log10(x); }
|
||||||
|
__CRT_INLINE float modff(float x, float *y) {
|
||||||
|
double di, df = modf(x, &di);
|
||||||
|
*y = (float) di; return (float) df;
|
||||||
}
|
}
|
||||||
|
__CRT_INLINE float powf(float x, float y) { return (float) pow(x, y); }
|
||||||
__CRT_INLINE float __cdecl ldexpf (float x, int expn) { return (float) ldexp (x, expn); }
|
__CRT_INLINE float sinf(float x) { return (float) sin(x); }
|
||||||
|
__CRT_INLINE float sinhf(float x) { return (float) sinh(x); }
|
||||||
|
__CRT_INLINE float sqrtf(float x) { return (float) sqrt(x); }
|
||||||
|
__CRT_INLINE float tanf(float x) { return (float) tan(x); }
|
||||||
|
__CRT_INLINE float tanhf(float x) { return (float) tanh(x); }
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
// cplusplus
|
// cplusplus
|
||||||
@ -366,31 +377,6 @@ extern "C" {
|
|||||||
extern double __cdecl logb (double);
|
extern double __cdecl logb (double);
|
||||||
extern float __cdecl logbf (float);
|
extern float __cdecl logbf (float);
|
||||||
extern long double __cdecl logbl (long double);
|
extern long double __cdecl logbl (long double);
|
||||||
|
|
||||||
__CRT_INLINE double __cdecl logb (double x)
|
|
||||||
{
|
|
||||||
double res;
|
|
||||||
__asm__ ("fxtract\n\t"
|
|
||||||
"fstp %%st" : "=t" (res) : "0" (x));
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
__CRT_INLINE float __cdecl logbf (float x)
|
|
||||||
{
|
|
||||||
float res;
|
|
||||||
__asm__ ("fxtract\n\t"
|
|
||||||
"fstp %%st" : "=t" (res) : "0" (x));
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
__CRT_INLINE long double __cdecl logbl (long double x)
|
|
||||||
{
|
|
||||||
long double res;
|
|
||||||
__asm__ ("fxtract\n\t"
|
|
||||||
"fstp %%st" : "=t" (res) : "0" (x));
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern long double __cdecl modfl (long double, long double*);
|
extern long double __cdecl modfl (long double, long double*);
|
||||||
|
|
||||||
/* 7.12.6.13 */
|
/* 7.12.6.13 */
|
||||||
|
Loading…
Reference in New Issue
Block a user