diff options
-rw-r--r-- | compat/nan.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/compat/nan.cpp b/compat/nan.cpp index 899b907a..a7b37362 100644 --- a/compat/nan.cpp +++ b/compat/nan.cpp @@ -1,17 +1,16 @@ -#include <cmath> #include "export.hpp" -#if defined(__GNUC__) -extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double value) -#elif defined(_WIN32) -extern "C" OPENTRACK_COMPAT_EXPORT __declspec(noinline) bool nanp(double value) +#if defined(_MSC_VER) +# include <cmath> +# define my_isnan std::isnan +# define my_isinf std::isinf +extern "C" OPENTRACK_COMPAT_EXPORT __declspec(noinline) bool nanp(double x) #else -extern "C" OPENTRACK_COMPAT_EXPORT bool nanp(double value) +int my_isnan(double)__asm__("isnan"); +int my_isinf(double)__asm__("isinf"); + +extern "C" OPENTRACK_COMPAT_EXPORT bool __attribute__ ((noinline)) nanp(double x) #endif { - using std::isnan; - using std::isinf; - - const volatile double x = value; - return isnan(x) || isinf(x); + return my_isnan(x) || my_isinf(x); } |