mirror of
https://git.planet-casio.com/Lephenixnoir/OpenLibm.git
synced 2025-01-01 06:23:39 +01:00
use C11 CMPLX or gcc __builtin_complex if available to define cpack macros
This commit is contained in:
parent
e08651b8a9
commit
67d2324543
1 changed files with 15 additions and 0 deletions
|
@ -260,7 +260,21 @@ typedef union {
|
||||||
* (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
|
* (0.0+I)*(y+0.0*I) and laboriously computing the full complex product.
|
||||||
* In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted
|
* In particular, I*Inf is corrupted to NaN+I*Inf, and I*-0 is corrupted
|
||||||
* to -0.0+I*0.0.
|
* to -0.0+I*0.0.
|
||||||
|
*
|
||||||
|
* In C11, a CMPLX(x,y) macro was added to circumvent this limitation,
|
||||||
|
* and gcc 4.7 added a __builtin_complex feature to simplify implementation
|
||||||
|
* of CMPLX in libc, so we can take advantage of these features if they
|
||||||
|
* are available.
|
||||||
*/
|
*/
|
||||||
|
#if defined(CMPLXF) && defined(CMPLX) && defined(CMPLXL) /* C11 */
|
||||||
|
# define cpackf(x,y) CMPLXF(x,y)
|
||||||
|
# define cpack(x,y) CMPLX(x,y)
|
||||||
|
# define cpackl(x,y) CMPLXL(x,y)
|
||||||
|
#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) && !defined(__INTEL_COMPILER)
|
||||||
|
# define cpackf(x,y) __builtin_complex ((float) (x), (float) (y))
|
||||||
|
# define cpack(x,y) __builtin_complex ((double) (x), (double) (y))
|
||||||
|
# define cpackl(x,y) __builtin_complex ((long double) (x), (long double) (y))
|
||||||
|
#else /* define our own cpack functions */
|
||||||
static __inline float complex
|
static __inline float complex
|
||||||
cpackf(float x, float y)
|
cpackf(float x, float y)
|
||||||
{
|
{
|
||||||
|
@ -290,6 +304,7 @@ cpackl(long double x, long double y)
|
||||||
IMAGPART(z) = y;
|
IMAGPART(z) = y;
|
||||||
return (z.f);
|
return (z.f);
|
||||||
}
|
}
|
||||||
|
#endif /* define our own cpack functions */
|
||||||
//VBS
|
//VBS
|
||||||
//#endif /* _COMPLEX_H */
|
//#endif /* _COMPLEX_H */
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue