From 2d72b58070bc43a727b580a46746e87215a60a33 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 29 Nov 2018 22:09:53 +0000 Subject: math: move complex math out of libm.h This makes it easier to build musl math code with a compiler that does not support complex types (tcc) and in general more sensible factorization of the internal headers. --- src/internal/complex_impl.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/internal/complex_impl.h (limited to 'src/internal/complex_impl.h') diff --git a/src/internal/complex_impl.h b/src/internal/complex_impl.h new file mode 100644 index 00000000..51fb298a --- /dev/null +++ b/src/internal/complex_impl.h @@ -0,0 +1,22 @@ +#ifndef _COMPLEX_IMPL_H +#define _COMPLEX_IMPL_H + +#include +#include "libm.h" + +#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) + +hidden double complex __ldexp_cexp(double complex,int); +hidden float complex __ldexp_cexpf(float complex,int); + +#endif -- cgit v1.2.1