fix fesetround error checking
[musl] / src / internal / libm.h
index 946c310..fd91627 100644 (file)
@@ -19,8 +19,6 @@
 #include <complex.h>
 #include <endian.h>
 
-#include "libc.h"
-
 #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024
 #elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN
 union ldshape {
@@ -30,6 +28,17 @@ union ldshape {
                uint16_t se;
        } i;
 };
+#elif LDBL_MANT_DIG == 64 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN
+/* This is the m68k variant of 80-bit long double, and this definition only works
+ * on archs where the alignment requirement of uint64_t is <= 4. */
+union ldshape {
+       long double f;
+       struct {
+               uint16_t se;
+               uint16_t pad;
+               uint64_t m;
+       } i;
+};
 #elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __LITTLE_ENDIAN
 union ldshape {
        long double f;
@@ -44,6 +53,20 @@ union ldshape {
                uint64_t hi;
        } i2;
 };
+#elif LDBL_MANT_DIG == 113 && LDBL_MAX_EXP == 16384 && __BYTE_ORDER == __BIG_ENDIAN
+union ldshape {
+       long double f;
+       struct {
+               uint16_t se;
+               uint16_t top;
+               uint32_t mid;
+               uint64_t lo;
+       } i;
+       struct {
+               uint64_t hi;
+               uint64_t lo;
+       } i2;
+};
 #else
 #error Unsupported long double representation
 #endif
@@ -130,42 +153,47 @@ do {                                              \
   (d) = __u.f;                                    \
 } while (0)
 
+#undef __CMPLX
+#undef CMPLX
+#undef CMPLXF
+#undef CMPLXL
+
+#define __CMPLX(x, y, t) \
+       ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z)
+
+#define CMPLX(x, y) __CMPLX(x, y, double)
+#define CMPLXF(x, y) __CMPLX(x, y, float)
+#define CMPLXL(x, y) __CMPLX(x, y, long double)
+
 /* fdlibm kernel functions */
 
-int    __rem_pio2_large(double*,double*,int,int,int);
+hidden int    __rem_pio2_large(double*,double*,int,int,int);
 
-int    __rem_pio2(double,double*);
-double __sin(double,double,int);
-double __cos(double,double);
-double __tan(double,double,int);
-double __expo2(double);
-double complex __ldexp_cexp(double complex,int);
+hidden int    __rem_pio2(double,double*);
+hidden double __sin(double,double,int);
+hidden double __cos(double,double);
+hidden double __tan(double,double,int);
+hidden double __expo2(double);
+hidden double complex __ldexp_cexp(double complex,int);
 
-int    __rem_pio2f(float,double*);
-float  __sindf(double);
-float  __cosdf(double);
-float  __tandf(double,int);
-float  __expo2f(float);
-float complex __ldexp_cexpf(float complex,int);
+hidden int    __rem_pio2f(float,double*);
+hidden float  __sindf(double);
+hidden float  __cosdf(double);
+hidden float  __tandf(double,int);
+hidden float  __expo2f(float);
+hidden float complex __ldexp_cexpf(float complex,int);
 
-int __rem_pio2l(long double, long double *);
-long double __sinl(long double, long double, int);
-long double __cosl(long double, long double);
-long double __tanl(long double, long double, int);
+hidden int __rem_pio2l(long double, long double *);
+hidden long double __sinl(long double, long double, int);
+hidden long double __cosl(long double, long double);
+hidden long double __tanl(long double, long double, int);
 
 /* polynomial evaluation */
-long double __polevll(long double, const long double *, int);
-long double __p1evll(long double, const long double *, int);
-
-#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
+hidden long double __polevll(long double, const long double *, int);
+hidden long double __p1evll(long double, const long double *, int);
+
+extern int __signgam;
+hidden double __lgamma_r(double, int *);
+hidden float __lgammaf_r(float, int *);
 
 #endif