From a4c5a5dc71f7f545137dd26565484d573ac7d2ba Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Mon, 12 Jun 2006 22:22:18 +0000 Subject: [PATCH] * include/math.h (HUGE_VAL): Define as builtin if __GNUC__ >= 3.3, else global library variable. (HUGEVALF): Likewise; (HUGEVALL): Likewise. (INFINITY): Likewise. (NAN): LiKewise. --- winsup/mingw/ChangeLog | 9 +++++++++ winsup/mingw/include/math.h | 22 +++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index ab937a73f..35c5ddebb 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,12 @@ +2006-06-13 Danny Smith + + * include/math.h (HUGE_VAL): Define as builtin if __GNUC__ >= 3.3, + else global library variable. + (HUGEVALF): Likewise; + (HUGEVALL): Likewise. + (INFINITY): Likewise. + (NAN): LiKewise. + 2006-06-13 Danny Smith * mingwex/wcrtomb.c (wcrtomb_cp): Correct typo. diff --git a/winsup/mingw/include/math.h b/winsup/mingw/include/math.h index 1bd9b16c3..0da7869ba 100644 --- a/winsup/mingw/include/math.h +++ b/winsup/mingw/include/math.h @@ -101,6 +101,10 @@ extern "C" { * NOTE: The CRTDLL version uses _HUGE_dll instead. */ +#if __MINGW_GNUC_PREREQ(3, 3) +#define HUGE_VAL __builtin_huge_val() +#else + #ifndef __DECLSPEC_SUPPORTED #ifdef __MSVCRT__ @@ -124,6 +128,8 @@ __MINGW_IMPORT double _HUGE_dll; #endif #endif /* __DECLSPEC_SUPPORTED */ +#endif /* __MINGW_GNUC_PREREQ(3, 3) */ + struct _exception { @@ -283,10 +289,20 @@ _CRTIMP int __cdecl _set_SSE2_enable (int); #if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) \ || !defined __STRICT_ANSI__ || defined __cplusplus -#define HUGE_VALF 0x1.0p255f -#define HUGE_VALL 0x1.0p32767L +#if __MINGW_GNUC_PREREQ(3, 3) +#define HUGE_VALF __builtin_huge_valf() +#define HUGE_VALL __builtin_huge_vall() +#define INFINITY __builtin_inf() +#define NAN __builtin_nan("") +#else +#extern const float __INFF; +#define HUGE_VALF __INFF +#extern const long double __INFL; +#define HUGE_VALL __INFL #define INFINITY HUGE_VALF -#define NAN (HUGE_VALF - HUGE_VALF) +extern const double __QNAN; +#define NAN __QNAN +#endif /* __MINGW_GNUC_PREREQ(3, 3) */ /* 7.12.3.1 */ /*