Added Sgn function
added hack for missing is_nan in mingw Thanks to Antonio Nicoletti
This commit is contained in:
parent
9edf3201b2
commit
8ee0aafb6e
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue