complex: add C11 CMPLX macros and replace cpack with them

This commit is contained in:
Szabolcs Nagy
2012-11-13 01:31:49 +01:00
parent e2fe959fe2
commit cfbaba79a2
47 changed files with 152 additions and 156 deletions

View File

@ -112,6 +112,15 @@ 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)
#if __STDC_VERSION__ >= 201112L
#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)
#endif
#ifdef __cplusplus
}
#endif