From 62edacece5cb3708a0661abdafc2d440a88b3d95 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 24 Aug 2006 20:16:25 +0000 Subject: [PATCH] From David Guthrie, "I know there are 50,000 changes to osg/Math for OSX a day, but I think it can be simplified quite a bit. The old code includes for pre-10.2 and anything using something other than g++ 4 and then uses std::isnan. For the most current version, it leaves out cmath and uses isnan(). std::isnan and cmath work for the current version, so I just made it include cmath if __APPLE__ is defined and removed the ifdef between versions of OS X for isnan related things. This way the code is all the same, and it's not fragile to someone including prior to including osg/Math." --- include/osg/Math | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/include/osg/Math b/include/osg/Math index 1e3ce7c7c..e459e1b1c 100644 --- a/include/osg/Math +++ b/include/osg/Math @@ -19,6 +19,10 @@ //certain math functions were not defined until 10.2 //so this code checks the version so it can add in workarounds for older versions. #ifdef __APPLE__ +// Using std::isnan will work for OS X, but use of +// and std:: are not necessarily portible with other systems so +// the include of is isolated here. +#include #include #if !defined(MAC_OS_X_VERSION_10_2) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_2) // One extra check to verify the gcc version. @@ -30,12 +34,6 @@ // this code path, but this is probably not what they want if using gcc 4+. #if (__GNUC__ < 4) #define APPLE_PRE_10_2 - // Use of isnan was causing problems if is used elsewhere - // in the code. seems to undef isnan which causes compile - // failures below. Using std::isnan will work, but use of - // and std:: are not necessarily portible with other systems so - // the include of is isolated here. - #include #endif #endif #endif @@ -195,18 +193,8 @@ inline double round(double v) { return v>=0.0?floor(v+0.5):ceil(v-0.5); } inline bool isNaN(double v) { return _isnan(v)!=0; } #else #if defined(__APPLE__) - #if !defined (APPLE_PRE_10_2) - #if __GNUC__ >= 4 - inline bool isNaN(float v) { return isnan(v); } - inline bool isNaN(double v) { return isnan(v); } - #else - inline bool isNaN(float v) { return std::isnan(v); } - inline bool isNaN(double v) { return std::isnan(v); } - #endif - #else - inline bool isNaN(float v) { return std::isnan(v); } - inline bool isNaN(double v) { return std::isnan(v); } - #endif + inline bool isNaN(float v) { return std::isnan(v); } + inline bool isNaN(double v) { return std::isnan(v); } #else // Need to use to std::isnan to avoid undef problem from inline bool isNaN(float v) { return isnan(v); }