Added Sgn function

added hack for missing is_nan in mingw 
Thanks to Antonio Nicoletti
This commit is contained in:
Paolo Cignoni 2016-02-11 15:43:20 +00:00
parent 9edf3201b2
commit 8ee0aafb6e
1 changed files with 6 additions and 0 deletions

View File

@ -186,9 +186,15 @@ inline float ToRad(const float &a){return float(M_PI)*a/180.0f;}
inline double ToDeg(const double &a){return a*180.0/M_PI;}
inline double ToRad(const double &a){return M_PI*a/180.0;}
template <typename T>
int Sgn(T val) {
return (T(0) < val) - (val < T(0));
}
#if defined(_MSC_VER) // Microsoft Visual C++
template<class T> int IsNAN(T t) { return _isnan(t) || (!_finite(t)); }
#elif defined(__MINGW32__) // GCC
template<class T> int IsNAN(T t) { return std::isnan(t) || std::isinf(t); }
#elif defined(__GNUC__) // GCC
template<class T> int IsNAN(T t) { return isnan(t) || isinf(t); }
#else // generic