[haiku-commits] haiku: hrev53693 - headers/posix

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 6 Jan 2020 02:44:33 -0500 (EST)

hrev53693 adds 1 changeset to branch 'master'
old head: a1e74397a17ddc927e5f24eec99c4edb6b5921e3
new head: dda1013cdb4781c4d2625a45ff9d84983e9eec86
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=dda1013cdb47+%5Ea1e74397a17d

----------------------------------------------------------------------------

dda1013cdb47: posix/math: Use the GCC built-ins when possible for isnan(), etc.
  
  glibc does the same. Technically, some of these builtins did
  not exist / did not work before GCC 4.4, but the source tree
  cannot be compiled with a version that old anyway.
  
  x86_64 and _x86 need to keep the old functions for now, of
  course; but all other architectures can probably feel free
  to drop the s_isnan, etc. functions from their glibc.
  
  This will make upcoming patches easier...
  
  Change-Id: Ifb76ea74076553228c9741a8ee3ecb0e1cf736a3
  Reviewed-on: https://review.haiku-os.org/c/haiku/+/2076
  Reviewed-by: waddlesplash <waddlesplash@xxxxxxxxx>

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

Revision:    hrev53693
Commit:      dda1013cdb4781c4d2625a45ff9d84983e9eec86
URL:         https://git.haiku-os.org/haiku/commit/?id=dda1013cdb47
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sun Jan  5 01:09:24 2020 UTC
Committer:   Adrien Destugues <pulkomandy@xxxxxxxxx>
Commit-Date: Mon Jan  6 07:44:30 2020 UTC

----------------------------------------------------------------------------

1 file changed, 10 insertions(+), 1 deletion(-)
headers/posix/math.h | 11 ++++++++++-

----------------------------------------------------------------------------

diff --git a/headers/posix/math.h b/headers/posix/math.h
index d094d0e970..a4bb33ef1f 100644
--- a/headers/posix/math.h
+++ b/headers/posix/math.h
@@ -338,7 +338,15 @@ extern float               y1f(float x);
 extern float           ynf(int x, float y);
 extern float           lgammaf_r(float x, int *y);
 
-
+#if __GNUC__ >= 7 || defined(__clang__)
+#define fpclassify(value) \
+       __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, 
FP_ZERO, (value))
+#define signbit(value) __builtin_signbit((value))
+#define isfinite(value)        __builtin_isfinite((value))
+#define isnormal(value)        __builtin_isnormal((value))
+#define isnan(value)   __builtin_isnan((value))
+#define isinf(value)   __builtin_isinf_sign((value))
+#else
 /* prototypes for functions used in the macros below */
 extern int                     __fpclassifyf(float value);
 extern int                     __signbitf(float value);
@@ -391,6 +399,7 @@ extern int                  __isinf(double value);
        (sizeof(value) == sizeof(float) ? __isinff(value)                       
\
                : sizeof(value) == sizeof(double) ? __isinf(value)              
\
                : __isinfl(value))
+#endif
 
 #if __GNUC__ >= 4
        #define isgreater(x, y)                 __builtin_isgreater((x), (y))


Other related posts:

  • » [haiku-commits] haiku: hrev53693 - headers/posix - Adrien Destugues