about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-12-17 16:08:50 -0500
committerRich Felker <dalias@aerifal.cx>2014-12-17 16:08:50 -0500
commita414e8374dfe32f5efd35a49592698f89878de1f (patch)
treea5f143eac19a69410e6df6b7191613f2db096800
parentefa9d396f9d3af6c6f85ec86302b48206c574a38 (diff)
downloadmusl-a414e8374dfe32f5efd35a49592698f89878de1f.tar.gz
musl-a414e8374dfe32f5efd35a49592698f89878de1f.tar.xz
musl-a414e8374dfe32f5efd35a49592698f89878de1f.zip
provide CMPLX macros in implementation-internal libm.h
this avoids assuming the presence of C11 macro definitions in the
public complex.h, which need changes potentially incompatible with the
way these macros are being used internally.
-rw-r--r--src/internal/libm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/internal/libm.h b/src/internal/libm.h
index ebcd7849..88a7eb47 100644
--- a/src/internal/libm.h
+++ b/src/internal/libm.h
@@ -128,6 +128,18 @@ 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);