diff options
author | Rich Felker <dalias@aerifal.cx> | 2012-03-22 15:54:55 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2012-03-22 15:54:55 -0400 |
commit | 13e400b3559666b5e584bdf6f8450aad826b43ae (patch) | |
tree | fb19a9f228b2a78dc8e8afc8f7d3439b0865c736 /src | |
parent | 132f0a00831d3b64cc6ae35df69d6865516c64b5 (diff) | |
download | musl-13e400b3559666b5e584bdf6f8450aad826b43ae.tar.gz musl-13e400b3559666b5e584bdf6f8450aad826b43ae.tar.bz2 musl-13e400b3559666b5e584bdf6f8450aad826b43ae.tar.xz musl-13e400b3559666b5e584bdf6f8450aad826b43ae.zip |
add creal/cimag macros in complex.h (and use them in the functions defs)
Diffstat (limited to 'src')
-rw-r--r-- | src/complex/cimag.c | 3 | ||||
-rw-r--r-- | src/complex/cimagf.c | 3 | ||||
-rw-r--r-- | src/complex/cimagl.c | 3 | ||||
-rw-r--r-- | src/complex/creal.c | 4 | ||||
-rw-r--r-- | src/complex/crealf.c | 4 | ||||
-rw-r--r-- | src/complex/creall.c | 4 | ||||
-rw-r--r-- | src/internal/libm.h | 8 |
7 files changed, 9 insertions, 20 deletions
diff --git a/src/complex/cimag.c b/src/complex/cimag.c index 5e1ad46b..00955641 100644 --- a/src/complex/cimag.c +++ b/src/complex/cimag.c @@ -2,6 +2,5 @@ double (cimag)(double complex z) { - union dcomplex u = {z}; - return u.a[1]; + return cimag(z); } diff --git a/src/complex/cimagf.c b/src/complex/cimagf.c index 99fffc58..f7bcd76e 100644 --- a/src/complex/cimagf.c +++ b/src/complex/cimagf.c @@ -2,6 +2,5 @@ float (cimagf)(float complex z) { - union fcomplex u = {z}; - return u.a[1]; + return cimagf(z); } diff --git a/src/complex/cimagl.c b/src/complex/cimagl.c index d9a0780c..9ec24eee 100644 --- a/src/complex/cimagl.c +++ b/src/complex/cimagl.c @@ -2,6 +2,5 @@ long double (cimagl)(long double complex z) { - union lcomplex u = {z}; - return u.a[1]; + return cimagl(z); } diff --git a/src/complex/creal.c b/src/complex/creal.c index 2bb91812..f6703040 100644 --- a/src/complex/creal.c +++ b/src/complex/creal.c @@ -1,6 +1,6 @@ #include <complex.h> -double creal(double complex z) +double (creal)(double complex z) { - return z; + return creal(z); } diff --git a/src/complex/crealf.c b/src/complex/crealf.c index 078232f0..5dc3ff1d 100644 --- a/src/complex/crealf.c +++ b/src/complex/crealf.c @@ -1,6 +1,6 @@ #include <complex.h> -float crealf(float complex z) +float (crealf)(float complex z) { - return z; + return crealf(z); } diff --git a/src/complex/creall.c b/src/complex/creall.c index 56e64097..fd9dc347 100644 --- a/src/complex/creall.c +++ b/src/complex/creall.c @@ -1,6 +1,6 @@ #include <complex.h> -long double creall(long double complex z) +long double (creall)(long double complex z) { - return z; + return creall(z); } diff --git a/src/internal/libm.h b/src/internal/libm.h index 67c42b98..8c5474a8 100644 --- a/src/internal/libm.h +++ b/src/internal/libm.h @@ -173,14 +173,6 @@ union lcomplex { long double a[2]; }; -// FIXME: move to complex.h ? -#define creal(z) ((double)(z)) -#define crealf(z) ((float)(z)) -#define creall(z) ((long double)(z)) -#define cimag(z) ((union dcomplex){(z)}.a[1]) -#define cimagf(z) ((union fcomplex){(z)}.a[1]) -#define cimagl(z) ((union lcomplex){(z)}.a[1]) - /* x + y*I is not supported properly by gcc */ #define cpack(x,y) ((union dcomplex){.a={(x),(y)}}.z) #define cpackf(x,y) ((union fcomplex){.a={(x),(y)}}.z) |