X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=include%2Fcomplex.h;h=13a45c57c200e9f671f738f66efb8ea6cf5945a9;hp=436f32f49c77fcb424cbb776be2872810c6b67e8;hb=40b2b5fa94d3ae27293f4d572bdcf1c3a5ef590f;hpb=494ba80e9a7f43be76dfee908bbd40ad0b608041 diff --git a/include/complex.h b/include/complex.h index 436f32f4..13a45c57 100644 --- a/include/complex.h +++ b/include/complex.h @@ -6,7 +6,11 @@ extern "C" { #endif #define complex _Complex +#ifdef __GNUC__ +#define _Complex_I (__extension__ 1.0fi) +#else #define _Complex_I 1.0fi +#endif #define I _Complex_I double complex cacos(double complex); @@ -108,6 +112,13 @@ long double creall(long double complex); #define cimagf(x) __CIMAG(x, float) #define cimagl(x) __CIMAG(x, long double) +#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) + #ifdef __cplusplus } #endif