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