]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Use uint32_t sign in single precision math error handling functions
authorSzabolcs Nagy <szabolcs.nagy@arm.com>
Wed, 13 Jun 2018 14:07:21 +0000 (15:07 +0100)
committerSzabolcs Nagy <szabolcs.nagy@arm.com>
Mon, 2 Jul 2018 08:29:04 +0000 (09:29 +0100)
Ideally sign should be bool, but 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.  The fixed size int is less ambigous than unsigned
long.

* sysdeps/ieee754/flt-32/e_powf.c (__powf): Use uint32_t.
(exp2f_inline): Likewise.
* sysdeps/ieee754/flt-32/math_config.h (__math_oflowf): Likewise.
(__math_uflowf): Likewise.
(__math_may_uflowf): Likewise.
(__math_divzerof): Likewise.
(__math_invalidf): Likewise.
* sysdeps/ieee754/flt-32/math_errf.c (xflowf): Likewise.
(__math_oflowf): Likewise.
(__math_uflowf): Likewise.
(__math_may_uflowf): Likewise.
(__math_divzerof): Likewise.
(__math_invalidf): Likewise.

ChangeLog
sysdeps/ieee754/flt-32/e_powf.c
sysdeps/ieee754/flt-32/math_config.h
sysdeps/ieee754/flt-32/math_errf.c

index 3371a9b6704da6f99734947772ac99aedc733cff..505498531041776d992623e48a669a1f6cfaf5be 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2018-07-02  Szabolcs Nagy  <szabolcs.nagy@arm.com>
+
+       * sysdeps/ieee754/flt-32/e_powf.c (__powf): Use uint32_t.
+       (exp2f_inline): Likewise.
+       * sysdeps/ieee754/flt-32/math_config.h (__math_oflowf): Likewise.
+       (__math_uflowf): Likewise.
+       (__math_may_uflowf): Likewise.
+       (__math_divzerof): Likewise.
+       (__math_invalidf): Likewise.
+       * sysdeps/ieee754/flt-32/math_errf.c (xflowf): Likewise.
+       (__math_oflowf): Likewise.
+       (__math_uflowf): Likewise.
+       (__math_may_uflowf): Likewise.
+       (__math_divzerof): Likewise.
+       (__math_invalidf): Likewise.
+
 2018-06-29  DJ Delorie  <dj@redhat.com>
            Carlos O'Donell  <carlos@redhat.com>
 
index 90661e221697d377d1f167be6497eae1aaba40c4..ece83f0dd2ef34f4f8081c2a2885f88afd405c47 100644 (file)
@@ -84,7 +84,7 @@ log2_inline (uint32_t ix)
    (in case of fast toint intrinsics) or not.  The unscaled xd must be
    in [-1021,1023], sign_bias sets the sign of the result.  */
 static inline double_t
-exp2_inline (double_t xd, unsigned long sign_bias)
+exp2_inline (double_t xd, uint32_t sign_bias)
 {
   uint64_t ki, ski, t;
   /* double_t for better performance on targets with FLT_EVAL_METHOD==2.  */
@@ -143,7 +143,7 @@ zeroinfnan (uint32_t ix)
 float
 __powf (float x, float y)
 {
-  unsigned long sign_bias = 0;
+  uint32_t sign_bias = 0;
   uint32_t ix, iy;
 
   ix = asuint (x);
index c4def9bbc1898d71865572d0084b219034bf3805..9c4ef301733baebf162791dc2f72ab45a6b3cad6 100644 (file)
@@ -102,10 +102,10 @@ issignalingf_inline (float x)
 
 #define NOINLINE __attribute__ ((noinline))
 
-attribute_hidden float __math_oflowf (unsigned long);
-attribute_hidden float __math_uflowf (unsigned long);
-attribute_hidden float __math_may_uflowf (unsigned long);
-attribute_hidden float __math_divzerof (unsigned long);
+attribute_hidden float __math_oflowf (uint32_t);
+attribute_hidden float __math_uflowf (uint32_t);
+attribute_hidden float __math_may_uflowf (uint32_t);
+attribute_hidden float __math_divzerof (uint32_t);
 attribute_hidden float __math_invalidf (float);
 
 /* Shared between expf, exp2f and powf.  */
index 7d58c0b8555a03bba4a0871c4f226f8d4faea3b2..5bc7ac6ef59e6a31bcf4f12077d4a32652a90bf0 100644 (file)
@@ -33,14 +33,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);
 }
 
 attribute_hidden float
-__math_uflowf (unsigned long sign)
+__math_uflowf (uint32_t sign)
 {
   return xflowf (sign, 0x1p-95f);
 }
@@ -49,20 +49,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.  */
 attribute_hidden float
-__math_may_uflowf (unsigned long sign)
+__math_may_uflowf (uint32_t sign)
 {
   return xflowf (sign, 0x1.4p-75f);
 }
 #endif
 
 attribute_hidden float
-__math_oflowf (unsigned long sign)
+__math_oflowf (uint32_t sign)
 {
   return xflowf (sign, 0x1p97f);
 }
 
 attribute_hidden float
-__math_divzerof (unsigned long sign)
+__math_divzerof (uint32_t sign)
 {
   float y = 0;
   return with_errnof ((sign ? -1 : 1) / y, ERANGE);