diff options
author | Joel Sherrill <joel@rtems.org> | 2024-07-01 15:51:24 -0500 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2024-07-03 08:52:33 -0500 |
commit | a5ffae145514df36ed134d3f36cedb9f81f743ea (patch) | |
tree | 782651551a6ce0ad4163ca502b83414335875033 | |
parent | a0637f8033a9de5ca2b0bbdc97ee2479a807425a (diff) | |
download | newlib-a5ffae145514df36ed134d3f36cedb9f81f743ea.zip newlib-a5ffae145514df36ed134d3f36cedb9f81f743ea.tar.gz newlib-a5ffae145514df36ed134d3f36cedb9f81f743ea.tar.bz2 |
libc/include/complex.h: Add CMPLX, CMPLXF, and CMPLXL
-rw-r--r-- | newlib/libc/include/complex.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/newlib/libc/include/complex.h b/newlib/libc/include/complex.h index ad3028e..dbabdf6 100644 --- a/newlib/libc/include/complex.h +++ b/newlib/libc/include/complex.h @@ -16,6 +16,19 @@ __BEGIN_DECLS +/* Implementation from FreeBSD */ +#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 */ + /* 7.3.5 Trigonometric functions */ /* 7.3.5.1 The cacos functions */ double complex cacos(double complex); |