mirror of
https://github.com/g-truc/glm.git
synced 2024-11-13 22:01:46 +00:00
Fixed VC warnings
This commit is contained in:
parent
bee480347c
commit
cec74162ff
@ -29,6 +29,12 @@
|
|||||||
#include <glm/vector_relational.hpp>
|
#include <glm/vector_relational.hpp>
|
||||||
#include <glm/common.hpp>
|
#include <glm/common.hpp>
|
||||||
|
|
||||||
|
#if ((GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC))
|
||||||
|
# define GLM_NAN(T) NAN
|
||||||
|
#else
|
||||||
|
# define GLM_NAN(T) (static_cast<T>(0.0f) / static_cast<T>(0.0f))
|
||||||
|
#endif
|
||||||
|
|
||||||
template <typename vecType>
|
template <typename vecType>
|
||||||
static int test_min()
|
static int test_min()
|
||||||
{
|
{
|
||||||
@ -38,6 +44,7 @@ static int test_min()
|
|||||||
|
|
||||||
vecType const N(static_cast<T>(0));
|
vecType const N(static_cast<T>(0));
|
||||||
vecType const B(static_cast<T>(1));
|
vecType const B(static_cast<T>(1));
|
||||||
|
|
||||||
Error += glm::all(glm::equal(glm::min(N, B), N, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::min(N, B), N, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::min(B, N), N, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::min(B, N), N, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
@ -67,9 +74,9 @@ static int test_min_nan()
|
|||||||
|
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
vecType const A(static_cast<T>(0));
|
|
||||||
vecType const B(static_cast<T>(1));
|
vecType const B(static_cast<T>(1));
|
||||||
vecType const N(A / A);
|
vecType const N(GLM_NAN(T));
|
||||||
|
|
||||||
Error += glm::all(glm::isnan(glm::min(N, B))) ? 0 : 1;
|
Error += glm::all(glm::isnan(glm::min(N, B))) ? 0 : 1;
|
||||||
Error += !glm::all(glm::isnan(glm::min(B, N))) ? 0 : 1;
|
Error += !glm::all(glm::isnan(glm::min(B, N))) ? 0 : 1;
|
||||||
|
|
||||||
@ -130,9 +137,8 @@ static int test_max_nan()
|
|||||||
|
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
vecType const A(static_cast<T>(0));
|
|
||||||
vecType const B(static_cast<T>(1));
|
vecType const B(static_cast<T>(1));
|
||||||
vecType const N(A / A);
|
vecType const N(GLM_NAN(T));
|
||||||
|
|
||||||
Error += glm::all(glm::isnan(glm::max(N, B))) ? 0 : 1;
|
Error += glm::all(glm::isnan(glm::max(N, B))) ? 0 : 1;
|
||||||
Error += !glm::all(glm::isnan(glm::max(B, N))) ? 0 : 1;
|
Error += !glm::all(glm::isnan(glm::max(B, N))) ? 0 : 1;
|
||||||
@ -163,26 +169,27 @@ static int test_fmin()
|
|||||||
|
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
vecType const A(static_cast<T>(0));
|
|
||||||
vecType const B(static_cast<T>(1));
|
vecType const B(static_cast<T>(1));
|
||||||
Error += glm::all(glm::equal(glm::fmin(A / A, B), B, glm::epsilon<T>())) ? 0 : 1;
|
vecType const N(GLM_NAN(T));
|
||||||
Error += glm::all(glm::equal(glm::fmin(B, A / A), B, glm::epsilon<T>())) ? 0 : 1;
|
|
||||||
|
Error += glm::all(glm::equal(glm::fmin(N, B), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
Error += glm::all(glm::equal(glm::fmin(B, N), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
vecType const C(static_cast<T>(2));
|
vecType const C(static_cast<T>(2));
|
||||||
Error += glm::all(glm::equal(glm::fmin(A / A, B, C), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(N, B, C), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(B, A / A, C), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(B, N, C), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(C, A / A, B), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(C, N, B), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(C, B, A / A), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(C, B, N), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(B, C, A / A), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(B, C, N), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(A / A, C, B), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(N, C, B), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
vecType const D(static_cast<T>(3));
|
vecType const D(static_cast<T>(3));
|
||||||
Error += glm::all(glm::equal(glm::fmin(D, A / A, B, C), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(D, N, B, C), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(B, D, A / A, C), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(B, D, N, C), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(C, A / A, D, B), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(C, N, D, B), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(C, B, D, A / A), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(C, B, D, N), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(B, C, A / A, D), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(B, C, N, D), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmin(A / A, C, B, D), B, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmin(N, C, B, D), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
@ -194,26 +201,27 @@ static int test_fmax()
|
|||||||
|
|
||||||
int Error = 0;
|
int Error = 0;
|
||||||
|
|
||||||
vecType const A(static_cast<T>(0));
|
|
||||||
vecType const B(static_cast<T>(1));
|
vecType const B(static_cast<T>(1));
|
||||||
Error += glm::all(glm::equal(glm::fmax(A / A, B), B, glm::epsilon<T>())) ? 0 : 1;
|
vecType const N(GLM_NAN(T));
|
||||||
Error += glm::all(glm::equal(glm::fmax(B, A / A), B, glm::epsilon<T>())) ? 0 : 1;
|
|
||||||
|
Error += glm::all(glm::equal(glm::fmax(N, B), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
Error += glm::all(glm::equal(glm::fmax(B, N), B, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
vecType const C(static_cast<T>(2));
|
vecType const C(static_cast<T>(2));
|
||||||
Error += glm::all(glm::equal(glm::fmax(A / A, B, C), C, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(N, B, C), C, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(B, A / A, C), C, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(B, N, C), C, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(C, A / A, B), C, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(C, N, B), C, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(C, B, A / A), C, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(C, B, N), C, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(B, C, A / A), C, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(B, C, N), C, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(A / A, C, B), C, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(N, C, B), C, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
vecType const D(static_cast<T>(3));
|
vecType const D(static_cast<T>(3));
|
||||||
Error += glm::all(glm::equal(glm::fmax(D, A / A, B, C), D, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(D, N, B, C), D, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(B, D, A / A, C), D, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(B, D, N, C), D, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(C, A / A, D, B), D, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(C, N, D, B), D, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(C, B, D, A / A), D, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(C, B, D, N), D, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(B, C, A / A, D), D, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(B, C, N, D), D, glm::epsilon<T>())) ? 0 : 1;
|
||||||
Error += glm::all(glm::equal(glm::fmax(A / A, C, B, D), D, glm::epsilon<T>())) ? 0 : 1;
|
Error += glm::all(glm::equal(glm::fmax(N, C, B, D), D, glm::epsilon<T>())) ? 0 : 1;
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user