From c29c7ad9fa44347ded60e483afc40aec46a99815 Mon Sep 17 00:00:00 2001 From: cxl Date: Sat, 18 Jan 2014 14:44:03 +0000 Subject: [PATCH] Core: IsInf git-svn-id: svn://ultimatepp.org/upp/trunk@6790 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Defs.h | 18 +++++++++++++----- uppsrc/Core/OL_Set.cpp | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/uppsrc/Core/Defs.h b/uppsrc/Core/Defs.h index 72cff59ee..c2b6f7984 100644 --- a/uppsrc/Core/Defs.h +++ b/uppsrc/Core/Defs.h @@ -330,14 +330,22 @@ typedef long long unsigned uint64; typedef uint64 qword; #ifdef PLATFORM_WIN32 -inline bool IsNaN(double d) { return findarg(_fpclass(d), _FPCLASS_QNAN, _FPCLASS_SNAN) >= 0; } -inline bool IsInf(double d) { return findarg(_fpclass(d), _FPCLASS_PINF, _FPCLASS_NINF) >= 0; } +#ifdef COMPILER_MINGW +inline bool IsNaN(double d) { return std::isnan(d); } +inline bool IsInf(double d) { return std::isinf(d); } #else -inline bool IsNaN(double d) { return fpclassify(d) == FP_NAN; } -inline bool IsInf(double d) { return fpclassify(d) == FP_INFINITY; } +inline bool IsNaN(double d) { return _isnan(d); } +inline bool IsInf(double d) { return _finite(d) && !_isnan(d); } +#endif +#elif __APPLE__ +inline bool IsNaN(double d) { return std::isnan(d); } +inline bool IsInf(double d) { return std::isinf(d); } +#else +inline bool IsNaN(double d) { return isnan(d); } +inline bool IsInf(double d) { return isinf(d); } #endif -inline bool IsFin(double d) { return !IsNaN(d) && !IsInf(d); } +inline bool IsFin(double d) { return !IsNaN(d) && !IsInf(d); } #ifdef COMPILER_MSC #define I64(c) ((int64)COMBINE(c, i64)) diff --git a/uppsrc/Core/OL_Set.cpp b/uppsrc/Core/OL_Set.cpp index bf768b166..315c077c3 100644 --- a/uppsrc/Core/OL_Set.cpp +++ b/uppsrc/Core/OL_Set.cpp @@ -1,5 +1,7 @@ //#BLITZ_PROHIBIT +// This file is explicitly removed from BLITZ to avoid inline optimizations + #ifndef flagNONAMESPACE namespace Upp { #endif