Simply use __imag__ to implement cimag().

We already use this construct in cabs() to call hypot(), so I guess we
can assume our targeted compilers support this construct.
This commit is contained in:
Ed Schouten 2015-01-09 13:40:29 +01:00
parent 08dbb2b517
commit a249c5ebb3
3 changed files with 3 additions and 12 deletions

View file

@ -26,7 +26,6 @@
* $FreeBSD: src/lib/msun/src/s_cimag.c,v 1.3 2009/03/14 18:24:15 das Exp $ * $FreeBSD: src/lib/msun/src/s_cimag.c,v 1.3 2009/03/14 18:24:15 das Exp $
*/ */
#include <openlibm.h>
#include <openlibm_complex.h> #include <openlibm_complex.h>
#include "math_private.h" #include "math_private.h"
@ -34,7 +33,5 @@
DLLEXPORT double DLLEXPORT double
cimag(double complex z) cimag(double complex z)
{ {
const double_complex z1 = { .f = z }; return (__imag__ z);
return (IMAGPART(z1));
} }

View file

@ -26,7 +26,6 @@
* $FreeBSD: src/lib/msun/src/s_cimagf.c,v 1.3 2009/03/14 18:24:15 das Exp $ * $FreeBSD: src/lib/msun/src/s_cimagf.c,v 1.3 2009/03/14 18:24:15 das Exp $
*/ */
#include <openlibm.h>
#include <openlibm_complex.h> #include <openlibm_complex.h>
#include "math_private.h" #include "math_private.h"
@ -34,7 +33,5 @@
DLLEXPORT float DLLEXPORT float
cimagf(float complex z) cimagf(float complex z)
{ {
const float_complex z1 = { .f = z }; return (__imag__ z);
return (IMAGPART(z1));
} }

View file

@ -26,7 +26,6 @@
* $FreeBSD: src/lib/msun/src/s_cimagl.c,v 1.3 2009/03/14 18:24:15 das Exp $ * $FreeBSD: src/lib/msun/src/s_cimagl.c,v 1.3 2009/03/14 18:24:15 das Exp $
*/ */
#include <openlibm.h>
#include <openlibm_complex.h> #include <openlibm_complex.h>
#include "math_private.h" #include "math_private.h"
@ -34,7 +33,5 @@
DLLEXPORT long double DLLEXPORT long double
cimagl(long double complex z) cimagl(long double complex z)
{ {
const long_double_complex z1 = { .f = z }; return (__imag__ z);
return (IMAGPART(z1));
} }