summaryrefslogtreecommitdiff
path: root/libc/include/complex.h
diff options
context:
space:
mode:
Diffstat (limited to 'libc/include/complex.h')
-rw-r--r--libc/include/complex.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libc/include/complex.h b/libc/include/complex.h
index 50da3306d..3fe8f359e 100644
--- a/libc/include/complex.h
+++ b/libc/include/complex.h
@@ -44,9 +44,15 @@ _Static_assert(__generic(_Complex_I, float _Complex, 1, 0),
#define I _Complex_I
#if __STDC_VERSION__ >= 201112L
+#ifdef __clang__
#define CMPLX(x, y) ((double complex){ x, y })
#define CMPLXF(x, y) ((float complex){ x, y })
#define CMPLXL(x, y) ((long double complex){ x, y })
+#else
+#define CMPLX(x, y) __builtin_complex((double)(x), (double)(y))
+#define CMPLXF(x, y) __builtin_complex((float)(x), (float)(y))
+#define CMPLXL(x, y) __builtin_complex((long double)(x), (long double)(y))
+#endif
#endif
__BEGIN_DECLS