diff options
Diffstat (limited to 'lib/ppc/multc3.c')
-rw-r--r-- | lib/ppc/multc3.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/lib/ppc/multc3.c b/lib/ppc/multc3.c index 9d17a2c6bc6a..738b65a83b03 100644 --- a/lib/ppc/multc3.c +++ b/lib/ppc/multc3.c @@ -3,23 +3,19 @@ */ #include "DD.h" -#include <math.h> +#include "../int_math.h" -#if !defined(INFINITY) && defined(HUGE_VAL) -#define INFINITY HUGE_VAL -#endif /* INFINITY */ +#define makeFinite(x) { \ + (x).s.hi = crt_copysign(crt_isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \ + (x).s.lo = 0.0; \ + } -#define makeFinite(x) { \ - (x).s.hi = __builtin_copysign(isinf((x).s.hi) ? 1.0 : 0.0, (x).s.hi); \ - (x).s.lo = 0.0; \ - } - -#define zeroNaN(x) { \ - if (isnan((x).s.hi)) { \ - (x).s.hi = __builtin_copysign(0.0, (x).s.hi); \ - (x).s.lo = 0.0; \ - } \ - } +#define zeroNaN(x) { \ + if (crt_isnan((x).s.hi)) { \ + (x).s.hi = crt_copysign(0.0, (x).s.hi); \ + (x).s.lo = 0.0; \ + } \ + } long double __gcc_qadd(long double, long double); long double __gcc_qsub(long double, long double); @@ -36,7 +32,7 @@ __multc3(long double a, long double b, long double c, long double d) DD real = { .ld = __gcc_qsub(ac,bd) }; DD imag = { .ld = __gcc_qadd(ad,bc) }; - if (isnan(real.s.hi) && isnan(imag.s.hi)) + if (crt_isnan(real.s.hi) && crt_isnan(imag.s.hi)) { int recalc = 0; @@ -45,7 +41,7 @@ __multc3(long double a, long double b, long double c, long double d) DD cDD = { .ld = c }; DD dDD = { .ld = d }; - if (isinf(aDD.s.hi) || isinf(bDD.s.hi)) + if (crt_isinf(aDD.s.hi) || crt_isinf(bDD.s.hi)) { makeFinite(aDD); makeFinite(bDD); @@ -54,7 +50,7 @@ __multc3(long double a, long double b, long double c, long double d) recalc = 1; } - if (isinf(cDD.s.hi) || isinf(dDD.s.hi)) + if (crt_isinf(cDD.s.hi) || crt_isinf(dDD.s.hi)) { makeFinite(cDD); makeFinite(dDD); @@ -70,7 +66,8 @@ __multc3(long double a, long double b, long double c, long double d) DD adDD = { .ld = ad }; DD bcDD = { .ld = bc }; - if (isinf(acDD.s.hi) || isinf(bdDD.s.hi) || isinf(adDD.s.hi) || isinf(bcDD.s.hi)) + if (crt_isinf(acDD.s.hi) || crt_isinf(bdDD.s.hi) || + crt_isinf(adDD.s.hi) || crt_isinf(bcDD.s.hi)) { zeroNaN(aDD); zeroNaN(bDD); @@ -82,9 +79,9 @@ __multc3(long double a, long double b, long double c, long double d) if (recalc) { - real.s.hi = INFINITY * (aDD.s.hi*cDD.s.hi - bDD.s.hi*dDD.s.hi); + real.s.hi = CRT_INFINITY * (aDD.s.hi*cDD.s.hi - bDD.s.hi*dDD.s.hi); real.s.lo = 0.0; - imag.s.hi = INFINITY * (aDD.s.hi*dDD.s.hi + bDD.s.hi*cDD.s.hi); + imag.s.hi = CRT_INFINITY * (aDD.s.hi*dDD.s.hi + bDD.s.hi*cDD.s.hi); imag.s.lo = 0.0; } } |