1/// @ref gtx_compatibility 2/// @file glm/gtx/compatibility.inl 3 4#include <limits> 5 6namespace glm 7{ 8 // isfinite 9 template <typename genType> 10 GLM_FUNC_QUALIFIER bool isfinite( 11 genType const & x) 12 { 13# if GLM_HAS_CXX11_STL 14 return std::isfinite(x) != 0; 15# elif GLM_COMPILER & GLM_COMPILER_VC 16 return _finite(x); 17# elif GLM_COMPILER & GLM_COMPILER_GCC && GLM_PLATFORM & GLM_PLATFORM_ANDROID 18 return _isfinite(x) != 0; 19# else 20 if (std::numeric_limits<genType>::is_integer || std::denorm_absent == std::numeric_limits<genType>::has_denorm) 21 return std::numeric_limits<genType>::min() <= x && std::numeric_limits<genType>::max() >= x; 22 else 23 return -std::numeric_limits<genType>::max() <= x && std::numeric_limits<genType>::max() >= x; 24# endif 25 } 26 27 template <typename T, precision P> 28 GLM_FUNC_QUALIFIER tvec1<bool, P> isfinite( 29 tvec1<T, P> const & x) 30 { 31 return tvec1<bool, P>( 32 isfinite(x.x)); 33 } 34 35 template <typename T, precision P> 36 GLM_FUNC_QUALIFIER tvec2<bool, P> isfinite( 37 tvec2<T, P> const & x) 38 { 39 return tvec2<bool, P>( 40 isfinite(x.x), 41 isfinite(x.y)); 42 } 43 44 template <typename T, precision P> 45 GLM_FUNC_QUALIFIER tvec3<bool, P> isfinite( 46 tvec3<T, P> const & x) 47 { 48 return tvec3<bool, P>( 49 isfinite(x.x), 50 isfinite(x.y), 51 isfinite(x.z)); 52 } 53 54 template <typename T, precision P> 55 GLM_FUNC_QUALIFIER tvec4<bool, P> isfinite( 56 tvec4<T, P> const & x) 57 { 58 return tvec4<bool, P>( 59 isfinite(x.x), 60 isfinite(x.y), 61 isfinite(x.z), 62 isfinite(x.w)); 63 } 64 65}//namespace glm 66