use __builtin_nanf with gcc and clang.

This commit is contained in:
Campbell Barton 2013-08-13 10:40:23 +00:00
parent a8d1c893e8
commit 5096beb4a5

@ -80,9 +80,13 @@
#define MAXFLOAT ((float)3.40282347e+38) #define MAXFLOAT ((float)3.40282347e+38)
#endif #endif
#if defined(__GNUC__)
# define NAN_FLT __builtin_nanf("")
#else
/* evil quiet NaN definition */ /* evil quiet NaN definition */
static const int NAN_INT = 0x7FC00000; static const int NAN_INT = 0x7FC00000;
#define NAN_FLT *((float *)(&NAN_INT)) # define NAN_FLT (*((float *)(&NAN_INT)))
#endif
/* do not redefine functions from C99 or POSIX.1-2001 */ /* do not redefine functions from C99 or POSIX.1-2001 */
#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)) #if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L))