X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Finternal%2Flibm.h;h=64cc83883b10892b9f4e53c7c02c099e55eeec35;hp=67c42b981c0163ce160975074aa9de5d5a9c7d06;hb=9448b0513e2eec020fbca9c10412b83df5027a16;hpb=97721a5508415a2f10eb068e022093811c9ff8be diff --git a/src/internal/libm.h b/src/internal/libm.h index 67c42b98..64cc8388 100644 --- a/src/internal/libm.h +++ b/src/internal/libm.h @@ -32,6 +32,19 @@ union dshape { uint64_t bits; }; +#define FORCE_EVAL(x) do { \ + if (sizeof(x) == sizeof(float)) { \ + volatile float __x; \ + __x = (x); \ + } else if (sizeof(x) == sizeof(double)) { \ + volatile double __x; \ + __x = (x); \ + } else { \ + volatile long double __x; \ + __x = (x); \ + } \ +} while(0) + /* Get two 32 bit ints from a double. */ #define EXTRACT_WORDS(hi,lo,d) \ do { \ @@ -144,46 +157,15 @@ long double __tanl(long double, long double, int); long double __polevll(long double, const long double *, int); long double __p1evll(long double, const long double *, int); -// FIXME: not needed when -fexcess-precision=standard is supported (>=gcc4.5) -/* - * Attempt to get strict C99 semantics for assignment with non-C99 compilers. - */ -#if 1 +#if 0 +/* Attempt to get strict C99 semantics for assignment with non-C99 compilers. */ #define STRICT_ASSIGN(type, lval, rval) do { \ volatile type __v = (rval); \ (lval) = __v; \ } while (0) #else +/* Should work with -fexcess-precision=standard (>=gcc-4.5) or -ffloat-store */ #define STRICT_ASSIGN(type, lval, rval) ((lval) = (type)(rval)) #endif - -/* complex */ - -union dcomplex { - double complex z; - double a[2]; -}; -union fcomplex { - float complex z; - float a[2]; -}; -union lcomplex { - long double complex z; - long double a[2]; -}; - -// FIXME: move to complex.h ? -#define creal(z) ((double)(z)) -#define crealf(z) ((float)(z)) -#define creall(z) ((long double)(z)) -#define cimag(z) ((union dcomplex){(z)}.a[1]) -#define cimagf(z) ((union fcomplex){(z)}.a[1]) -#define cimagl(z) ((union lcomplex){(z)}.a[1]) - -/* x + y*I is not supported properly by gcc */ -#define cpack(x,y) ((union dcomplex){.a={(x),(y)}}.z) -#define cpackf(x,y) ((union fcomplex){.a={(x),(y)}}.z) -#define cpackl(x,y) ((union lcomplex){.a={(x),(y)}}.z) - #endif