summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2013-05-25 18:55:55 +0000
committerEd Schouten <ed@FreeBSD.org>2013-05-25 18:55:55 +0000
commite814330de14da51f4555e8b075913e3d29f8ead1 (patch)
treec8bfcd898a80d02008fb3212e1917663c53c3079 /include
parent5f4cd89cced01aec1f537bd3c8992e31ad399def (diff)
downloadsrc-test2-e814330de14da51f4555e8b075913e3d29f8ead1.tar.gz
src-test2-e814330de14da51f4555e8b075913e3d29f8ead1.zip
Notes
Diffstat (limited to 'include')
-rw-r--r--include/complex.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/complex.h b/include/complex.h
index 0702541c44aa..e7770821b816 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -46,6 +46,18 @@ _Static_assert(__generic(_Complex_I, float _Complex, 1, 0),
#define complex _Complex
#define I _Complex_I
+#if __ISO_C_VISIBLE >= 2011
+#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 })
+#elif __GNUC_PREREQ__(4, 7)
+#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 /* __ISO_C_VISIBLE >= 2011 */
+
__BEGIN_DECLS
double cabs(double complex);