From 04c4a959cd0064e2262d78da75ea64d5359e05de Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 10 Sep 2011 14:55:44 +0000 Subject: [PATCH] core: add our custom isnan() macro to the core headers. --- src/core.h | 15 +++++++++++++++ test/half.cpp | 13 ------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/core.h b/src/core.h index cc592461..29c47061 100644 --- a/src/core.h +++ b/src/core.h @@ -45,6 +45,21 @@ # define FP_USE(x) (void)(x) #endif +/* Ensure isnan() is present even on systems that don't define it, or + * when -ffast-math is being used. */ +#if defined __FAST_MATH__ +# undef isnan +#endif +#if !defined isnan +# define isnan isnan +# include +static inline int isnan(float f) +{ + union { float f; uint32_t x; } u = { f }; + return (u.x << 1) > 0xff000000u; +} +#endif + // Base types #include "trig.h" #include "half.h" diff --git a/test/half.cpp b/test/half.cpp index 8740857a..cf88ad36 100644 --- a/test/half.cpp +++ b/test/half.cpp @@ -17,19 +17,6 @@ #include "core.h" #include "lol/unit.h" -/* Ensure isnan() is present even on systems that don't define it, or - * when -ffast-math is being used. */ -#if defined __FAST_MATH__ -# undef isnan -#endif -#if !defined isnan -static inline int isnan(float f) -{ - union { float f; uint32_t x; } u = { f }; - return (u.x << 1) > 0xff000000u; -} -#endif - namespace lol {