X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=include%2Fcomplex.h;h=436f32f49c77fcb424cbb776be2872810c6b67e8;hp=8ee70575cbb0761f42db9900e36f284aff570945;hb=ea544bfe808ef74c6d1727312069c12dd1c5c150;hpb=b69f695acedd4ce2798ef9ea28d834ceccc789bd diff --git a/include/complex.h b/include/complex.h index 8ee70575..436f32f4 100644 --- a/include/complex.h +++ b/include/complex.h @@ -97,6 +97,17 @@ double creal(double complex); float crealf(float complex); long double creall(long double complex); +#define __CIMAG(x, t) \ + ((union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1]) + +#define creal(x) ((double)(x)) +#define crealf(x) ((float)(x)) +#define creall(x) ((long double)(x)) + +#define cimag(x) __CIMAG(x, double) +#define cimagf(x) __CIMAG(x, float) +#define cimagl(x) __CIMAG(x, long double) + #ifdef __cplusplus } #endif