Patch by Paul Davey with minor style changes by myself: For gcc 4 (and clang)

define the HUGE_VAL and friends macros to the respective __builtin_*()
functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39307 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2010-11-05 13:20:52 +00:00
parent aa3507feea
commit 7aff60b7de
+13 -1
View File
@@ -21,6 +21,18 @@
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ #define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
/* platform independent IEEE floating point special values */ /* platform independent IEEE floating point special values */
#if __GNUC__ >= 4
/* gcc4 and clang definitions */
# ifndef HUGE_VAL
# define HUGE_VAL __builtin_huge_val()
# endif
# define HUGE_VALF __builtin_huge_valf()
# define HUGE_VALL __builtin_huge_vall()
# define NAN __builtin_nanf("")
# define INFINITY __builtin_inff()
#else
/* gcc2 definitions */
# define __HUGE_VAL_v 0x7ff0000000000000LL # define __HUGE_VAL_v 0x7ff0000000000000LL
# define __huge_val_t union { unsigned char __c[8]; long long __ll; double __d; } # define __huge_val_t union { unsigned char __c[8]; long long __ll; double __d; }
# ifndef HUGE_VAL # ifndef HUGE_VAL
@@ -35,8 +47,8 @@
# define __NAN_VALF_v 0x7fc00000L # define __NAN_VALF_v 0x7fc00000L
# define NAN (((__huge_valf_t) { __l: __NAN_VALF_v }).__f) # define NAN (((__huge_valf_t) { __l: __NAN_VALF_v }).__f)
# define INFINITY HUGE_VALF # define INFINITY HUGE_VALF
#endif
/* floating-point categories */ /* floating-point categories */
#define FP_NAN 0 #define FP_NAN 0