projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
semaphores: fix missed wakes from ABA bug in waiter count logic
[musl]
/
include
/
complex.h
diff --git
a/include/complex.h
b/include/complex.h
index
8206e02
..
008b3c7
100644
(file)
--- a/
include/complex.h
+++ b/
include/complex.h
@@
-7,9
+7,9
@@
extern "C" {
#define complex _Complex
#ifdef __GNUC__
#define complex _Complex
#ifdef __GNUC__
-#define _Complex_I (__extension__
1.0fi
)
+#define _Complex_I (__extension__
(0.0f+1.0fi)
)
#else
#else
-#define _Complex_I
1.0fi
+#define _Complex_I
(0.0f+1.0fi)
#endif
#define I _Complex_I
#endif
#define I _Complex_I
@@
-101,8
+101,9
@@
double creal(double complex);
float crealf(float complex);
long double creall(long double complex);
float crealf(float complex);
long double creall(long double complex);
+#ifndef __cplusplus
#define __CIMAG(x, t) \
#define __CIMAG(x, t) \
- ((union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
+ (
+
(union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1])
#define creal(x) ((double)(x))
#define crealf(x) ((float)(x))
#define creal(x) ((double)(x))
#define crealf(x) ((float)(x))
@@
-111,11
+112,16
@@
long double creall(long double complex);
#define cimag(x) __CIMAG(x, double)
#define cimagf(x) __CIMAG(x, float)
#define cimagl(x) __CIMAG(x, long double)
#define cimag(x) __CIMAG(x, double)
#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)
+#endif
#if __STDC_VERSION__ >= 201112L
#if __STDC_VERSION__ >= 201112L
+#if defined(_Imaginary_I)
+#define __CMPLX(x, y, t) ((t)(x) + _Imaginary_I*(t)(y))
+#elif defined(__clang__)
+#define __CMPLX(x, y, t) (+(_Complex t){ (t)(x), (t)(y) })
+#else
+#define __CMPLX(x, y, t) (__builtin_complex((t)(x), (t)(y)))
+#endif
#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)
#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)