diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-05-10 17:53:31 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2018-05-16 13:52:13 +0100 |
commit | c65db17340782d647c49e17cbba244862dc38402 (patch) | |
tree | 781a38089ac7431fba502e213a328bca0f3a0b14 /math/math_errf.c | |
parent | 2f2d687988c6614e3d2f8636dce5b2d1a10683e5 (diff) | |
download | arm-optimized-routines-c65db17340782d647c49e17cbba244862dc38402.tar.gz |
Use fixed 32bit sign argument to error functions
Ideally sign should be bool, but we don't want to depend on stdbool.h
and sometimes (e.g. in powf) it's more efficient to pass a non-zero
value than 1 to indicate that the sign should be set.
While working on double precision versions i realized that the unsigned
long argument is fragile (may fail on 32bit targets only).
Diffstat (limited to 'math/math_errf.c')
-rw-r--r-- | math/math_errf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/math/math_errf.c b/math/math_errf.c index cd6df2c..c96c5df 100644 --- a/math/math_errf.c +++ b/math/math_errf.c @@ -35,14 +35,14 @@ with_errnof (float y, int e) /* NOINLINE prevents fenv semantics breaking optimizations. */ NOINLINE static float -xflowf (unsigned long sign, float y) +xflowf (uint32_t sign, float y) { y = (sign ? -y : y) * y; return with_errnof (y, ERANGE); } HIDDEN float -__math_uflowf (unsigned long sign) +__math_uflowf (uint32_t sign) { return xflowf (sign, 0x1p-95f); } @@ -51,20 +51,20 @@ __math_uflowf (unsigned long sign) /* Underflows to zero in some non-nearest rounding mode, setting errno is valid even if the result is non-zero, but in the subnormal range. */ HIDDEN float -__math_may_uflowf (unsigned long sign) +__math_may_uflowf (uint32_t sign) { return xflowf (sign, 0x1.4p-75f); } #endif HIDDEN float -__math_oflowf (unsigned long sign) +__math_oflowf (uint32_t sign) { return xflowf (sign, 0x1p97f); } HIDDEN float -__math_divzerof (unsigned long sign) +__math_divzerof (uint32_t sign) { float y = 0; return with_errnof ((sign ? -1 : 1) / y, ERANGE); |