diff --git a/CMakeLists.txt b/CMakeLists.txt index 915f8a1f..66c29c8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ endif() # Compiler and default options -if((CMAKE_CXX_COMPILER_ID MATCHES "Clang")) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") message("GLM: Clang - ${CMAKE_CXX_COMPILER_ID} compiler") add_compile_options(-Werror -Weverything) @@ -152,7 +152,8 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel") elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") message("GLM: Visual C++ - ${CMAKE_CXX_COMPILER_ID} compiler") - add_compile_options(/FAs) + add_compile_options(/FAs /W4 /WX) + add_compile_options(/wd4324 /wd4389 /wd4127 /wd4309 /wd4267 /wd4146 /wd4201 /wd4464 /wd4514 /wd4701 /wd4820 /wd4365) add_definitions(-D_CRT_SECURE_NO_WARNINGS) endif() diff --git a/glm/CMakeLists.txt b/glm/CMakeLists.txt index 93f446bd..d60a8877 100644 --- a/glm/CMakeLists.txt +++ b/glm/CMakeLists.txt @@ -63,6 +63,5 @@ else(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER} ${SIMD_SOURCE} ${SIMD_INLINE} ${SIMD_HEADER}) - target_compile_options(glm_dummy PRIVATE -ffast-math) endif(GLM_STATIC_LIBRARY_ENABLE OR GLM_DYNAMIC_LIBRARY_ENABLE) diff --git a/glm/gtc/bitfield.inl b/glm/gtc/bitfield.inl index fabfd1a0..66ac4a43 100644 --- a/glm/gtc/bitfield.inl +++ b/glm/gtc/bitfield.inl @@ -21,14 +21,14 @@ namespace detail glm::uint16 REG1(x); glm::uint16 REG2(y); - REG1 = ((REG1 << 4) | REG1) & glm::uint16(0x0F0F); - REG2 = ((REG2 << 4) | REG2) & glm::uint16(0x0F0F); + REG1 = ((REG1 << 4) | REG1) & static_cast(0x0F0F); + REG2 = ((REG2 << 4) | REG2) & static_cast(0x0F0F); - REG1 = ((REG1 << 2) | REG1) & glm::uint16(0x3333); - REG2 = ((REG2 << 2) | REG2) & glm::uint16(0x3333); + REG1 = ((REG1 << 2) | REG1) & static_cast(0x3333); + REG2 = ((REG2 << 2) | REG2) & static_cast(0x3333); - REG1 = ((REG1 << 1) | REG1) & glm::uint16(0x5555); - REG2 = ((REG2 << 1) | REG2) & glm::uint16(0x5555); + REG1 = ((REG1 << 1) | REG1) & static_cast(0x5555); + REG2 = ((REG2 << 1) | REG2) & static_cast(0x5555); return REG1 | static_cast(REG2 << 1); } @@ -39,17 +39,17 @@ namespace detail glm::uint32 REG1(x); glm::uint32 REG2(y); - REG1 = ((REG1 << 8) | REG1) & glm::uint32(0x00FF00FF); - REG2 = ((REG2 << 8) | REG2) & glm::uint32(0x00FF00FF); + REG1 = ((REG1 << 8) | REG1) & static_cast(0x00FF00FF); + REG2 = ((REG2 << 8) | REG2) & static_cast(0x00FF00FF); - REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x0F0F0F0F); - REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x0F0F0F0F); + REG1 = ((REG1 << 4) | REG1) & static_cast(0x0F0F0F0F); + REG2 = ((REG2 << 4) | REG2) & static_cast(0x0F0F0F0F); - REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x33333333); - REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x33333333); + REG1 = ((REG1 << 2) | REG1) & static_cast(0x33333333); + REG2 = ((REG2 << 2) | REG2) & static_cast(0x33333333); - REG1 = ((REG1 << 1) | REG1) & glm::uint32(0x55555555); - REG2 = ((REG2 << 1) | REG2) & glm::uint32(0x55555555); + REG1 = ((REG1 << 1) | REG1) & static_cast(0x55555555); + REG2 = ((REG2 << 1) | REG2) & static_cast(0x55555555); return REG1 | (REG2 << 1); } @@ -60,20 +60,20 @@ namespace detail glm::uint64 REG1(x); glm::uint64 REG2(y); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x0000FFFF0000FFFFull); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x0000FFFF0000FFFFull); + REG1 = ((REG1 << 16) | REG1) & static_cast(0x0000FFFF0000FFFFull); + REG2 = ((REG2 << 16) | REG2) & static_cast(0x0000FFFF0000FFFFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0x00FF00FF00FF00FFull); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0x00FF00FF00FF00FFull); + REG1 = ((REG1 << 8) | REG1) & static_cast(0x00FF00FF00FF00FFull); + REG2 = ((REG2 << 8) | REG2) & static_cast(0x00FF00FF00FF00FFull); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x0F0F0F0F0F0F0F0Full); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x0F0F0F0F0F0F0F0Full); + REG1 = ((REG1 << 4) | REG1) & static_cast(0x0F0F0F0F0F0F0F0Full); + REG2 = ((REG2 << 4) | REG2) & static_cast(0x0F0F0F0F0F0F0F0Full); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x3333333333333333ull); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x3333333333333333ull); + REG1 = ((REG1 << 2) | REG1) & static_cast(0x3333333333333333ull); + REG2 = ((REG2 << 2) | REG2) & static_cast(0x3333333333333333ull); - REG1 = ((REG1 << 1) | REG1) & glm::uint64(0x5555555555555555ull); - REG2 = ((REG2 << 1) | REG2) & glm::uint64(0x5555555555555555ull); + REG1 = ((REG1 << 1) | REG1) & static_cast(0x5555555555555555ull); + REG2 = ((REG2 << 1) | REG2) & static_cast(0x5555555555555555ull); return REG1 | (REG2 << 1); } @@ -85,21 +85,21 @@ namespace detail glm::uint32 REG2(y); glm::uint32 REG3(z); - REG1 = ((REG1 << 16) | REG1) & glm::uint32(0x00FF0000FF0000FF); - REG2 = ((REG2 << 16) | REG2) & glm::uint32(0x00FF0000FF0000FF); - REG3 = ((REG3 << 16) | REG3) & glm::uint32(0x00FF0000FF0000FF); + REG1 = ((REG1 << 16) | REG1) & static_cast(0x00FF0000FF0000FF); + REG2 = ((REG2 << 16) | REG2) & static_cast(0x00FF0000FF0000FF); + REG3 = ((REG3 << 16) | REG3) & static_cast(0x00FF0000FF0000FF); - REG1 = ((REG1 << 8) | REG1) & glm::uint32(0xF00F00F00F00F00F); - REG2 = ((REG2 << 8) | REG2) & glm::uint32(0xF00F00F00F00F00F); - REG3 = ((REG3 << 8) | REG3) & glm::uint32(0xF00F00F00F00F00F); + REG1 = ((REG1 << 8) | REG1) & static_cast(0xF00F00F00F00F00F); + REG2 = ((REG2 << 8) | REG2) & static_cast(0xF00F00F00F00F00F); + REG3 = ((REG3 << 8) | REG3) & static_cast(0xF00F00F00F00F00F); - REG1 = ((REG1 << 4) | REG1) & glm::uint32(0x30C30C30C30C30C3); - REG2 = ((REG2 << 4) | REG2) & glm::uint32(0x30C30C30C30C30C3); - REG3 = ((REG3 << 4) | REG3) & glm::uint32(0x30C30C30C30C30C3); + REG1 = ((REG1 << 4) | REG1) & static_cast(0x30C30C30C30C30C3); + REG2 = ((REG2 << 4) | REG2) & static_cast(0x30C30C30C30C30C3); + REG3 = ((REG3 << 4) | REG3) & static_cast(0x30C30C30C30C30C3); - REG1 = ((REG1 << 2) | REG1) & glm::uint32(0x9249249249249249); - REG2 = ((REG2 << 2) | REG2) & glm::uint32(0x9249249249249249); - REG3 = ((REG3 << 2) | REG3) & glm::uint32(0x9249249249249249); + REG1 = ((REG1 << 2) | REG1) & static_cast(0x9249249249249249); + REG2 = ((REG2 << 2) | REG2) & static_cast(0x9249249249249249); + REG3 = ((REG3 << 2) | REG3) & static_cast(0x9249249249249249); return REG1 | (REG2 << 1) | (REG3 << 2); } @@ -111,25 +111,25 @@ namespace detail glm::uint64 REG2(y); glm::uint64 REG3(z); - REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull); - REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull); - REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull); + REG1 = ((REG1 << 32) | REG1) & static_cast(0xFFFF00000000FFFFull); + REG2 = ((REG2 << 32) | REG2) & static_cast(0xFFFF00000000FFFFull); + REG3 = ((REG3 << 32) | REG3) & static_cast(0xFFFF00000000FFFFull); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull); - REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull); + REG1 = ((REG1 << 16) | REG1) & static_cast(0x00FF0000FF0000FFull); + REG2 = ((REG2 << 16) | REG2) & static_cast(0x00FF0000FF0000FFull); + REG3 = ((REG3 << 16) | REG3) & static_cast(0x00FF0000FF0000FFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full); - REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full); + REG1 = ((REG1 << 8) | REG1) & static_cast(0xF00F00F00F00F00Full); + REG2 = ((REG2 << 8) | REG2) & static_cast(0xF00F00F00F00F00Full); + REG3 = ((REG3 << 8) | REG3) & static_cast(0xF00F00F00F00F00Full); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull); - REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull); + REG1 = ((REG1 << 4) | REG1) & static_cast(0x30C30C30C30C30C3ull); + REG2 = ((REG2 << 4) | REG2) & static_cast(0x30C30C30C30C30C3ull); + REG3 = ((REG3 << 4) | REG3) & static_cast(0x30C30C30C30C30C3ull); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull); - REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull); + REG1 = ((REG1 << 2) | REG1) & static_cast(0x9249249249249249ull); + REG2 = ((REG2 << 2) | REG2) & static_cast(0x9249249249249249ull); + REG3 = ((REG3 << 2) | REG3) & static_cast(0x9249249249249249ull); return REG1 | (REG2 << 1) | (REG3 << 2); } @@ -141,25 +141,25 @@ namespace detail glm::uint64 REG2(y); glm::uint64 REG3(z); - REG1 = ((REG1 << 32) | REG1) & glm::uint64(0xFFFF00000000FFFFull); - REG2 = ((REG2 << 32) | REG2) & glm::uint64(0xFFFF00000000FFFFull); - REG3 = ((REG3 << 32) | REG3) & glm::uint64(0xFFFF00000000FFFFull); + REG1 = ((REG1 << 32) | REG1) & static_cast(0xFFFF00000000FFFFull); + REG2 = ((REG2 << 32) | REG2) & static_cast(0xFFFF00000000FFFFull); + REG3 = ((REG3 << 32) | REG3) & static_cast(0xFFFF00000000FFFFull); - REG1 = ((REG1 << 16) | REG1) & glm::uint64(0x00FF0000FF0000FFull); - REG2 = ((REG2 << 16) | REG2) & glm::uint64(0x00FF0000FF0000FFull); - REG3 = ((REG3 << 16) | REG3) & glm::uint64(0x00FF0000FF0000FFull); + REG1 = ((REG1 << 16) | REG1) & static_cast(0x00FF0000FF0000FFull); + REG2 = ((REG2 << 16) | REG2) & static_cast(0x00FF0000FF0000FFull); + REG3 = ((REG3 << 16) | REG3) & static_cast(0x00FF0000FF0000FFull); - REG1 = ((REG1 << 8) | REG1) & glm::uint64(0xF00F00F00F00F00Full); - REG2 = ((REG2 << 8) | REG2) & glm::uint64(0xF00F00F00F00F00Full); - REG3 = ((REG3 << 8) | REG3) & glm::uint64(0xF00F00F00F00F00Full); + REG1 = ((REG1 << 8) | REG1) & static_cast(0xF00F00F00F00F00Full); + REG2 = ((REG2 << 8) | REG2) & static_cast(0xF00F00F00F00F00Full); + REG3 = ((REG3 << 8) | REG3) & static_cast(0xF00F00F00F00F00Full); - REG1 = ((REG1 << 4) | REG1) & glm::uint64(0x30C30C30C30C30C3ull); - REG2 = ((REG2 << 4) | REG2) & glm::uint64(0x30C30C30C30C30C3ull); - REG3 = ((REG3 << 4) | REG3) & glm::uint64(0x30C30C30C30C30C3ull); + REG1 = ((REG1 << 4) | REG1) & static_cast(0x30C30C30C30C30C3ull); + REG2 = ((REG2 << 4) | REG2) & static_cast(0x30C30C30C30C30C3ull); + REG3 = ((REG3 << 4) | REG3) & static_cast(0x30C30C30C30C30C3ull); - REG1 = ((REG1 << 2) | REG1) & glm::uint64(0x9249249249249249ull); - REG2 = ((REG2 << 2) | REG2) & glm::uint64(0x9249249249249249ull); - REG3 = ((REG3 << 2) | REG3) & glm::uint64(0x9249249249249249ull); + REG1 = ((REG1 << 2) | REG1) & static_cast(0x9249249249249249ull); + REG2 = ((REG2 << 2) | REG2) & static_cast(0x9249249249249249ull); + REG3 = ((REG3 << 2) | REG3) & static_cast(0x9249249249249249ull); return REG1 | (REG2 << 1) | (REG3 << 2); } @@ -172,20 +172,20 @@ namespace detail glm::uint32 REG3(z); glm::uint32 REG4(w); - REG1 = ((REG1 << 12) | REG1) & glm::uint32(0x000F000F000F000F); - REG2 = ((REG2 << 12) | REG2) & glm::uint32(0x000F000F000F000F); - REG3 = ((REG3 << 12) | REG3) & glm::uint32(0x000F000F000F000F); - REG4 = ((REG4 << 12) | REG4) & glm::uint32(0x000F000F000F000F); + REG1 = ((REG1 << 12) | REG1) & static_cast(0x000F000F000F000F); + REG2 = ((REG2 << 12) | REG2) & static_cast(0x000F000F000F000F); + REG3 = ((REG3 << 12) | REG3) & static_cast(0x000F000F000F000F); + REG4 = ((REG4 << 12) | REG4) & static_cast(0x000F000F000F000F); - REG1 = ((REG1 << 6) | REG1) & glm::uint32(0x0303030303030303); - REG2 = ((REG2 << 6) | REG2) & glm::uint32(0x0303030303030303); - REG3 = ((REG3 << 6) | REG3) & glm::uint32(0x0303030303030303); - REG4 = ((REG4 << 6) | REG4) & glm::uint32(0x0303030303030303); + REG1 = ((REG1 << 6) | REG1) & static_cast(0x0303030303030303); + REG2 = ((REG2 << 6) | REG2) & static_cast(0x0303030303030303); + REG3 = ((REG3 << 6) | REG3) & static_cast(0x0303030303030303); + REG4 = ((REG4 << 6) | REG4) & static_cast(0x0303030303030303); - REG1 = ((REG1 << 3) | REG1) & glm::uint32(0x1111111111111111); - REG2 = ((REG2 << 3) | REG2) & glm::uint32(0x1111111111111111); - REG3 = ((REG3 << 3) | REG3) & glm::uint32(0x1111111111111111); - REG4 = ((REG4 << 3) | REG4) & glm::uint32(0x1111111111111111); + REG1 = ((REG1 << 3) | REG1) & static_cast(0x1111111111111111); + REG2 = ((REG2 << 3) | REG2) & static_cast(0x1111111111111111); + REG3 = ((REG3 << 3) | REG3) & static_cast(0x1111111111111111); + REG4 = ((REG4 << 3) | REG4) & static_cast(0x1111111111111111); return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3); } @@ -198,25 +198,25 @@ namespace detail glm::uint64 REG3(z); glm::uint64 REG4(w); - REG1 = ((REG1 << 24) | REG1) & glm::uint64(0x000000FF000000FFull); - REG2 = ((REG2 << 24) | REG2) & glm::uint64(0x000000FF000000FFull); - REG3 = ((REG3 << 24) | REG3) & glm::uint64(0x000000FF000000FFull); - REG4 = ((REG4 << 24) | REG4) & glm::uint64(0x000000FF000000FFull); + REG1 = ((REG1 << 24) | REG1) & static_cast(0x000000FF000000FFull); + REG2 = ((REG2 << 24) | REG2) & static_cast(0x000000FF000000FFull); + REG3 = ((REG3 << 24) | REG3) & static_cast(0x000000FF000000FFull); + REG4 = ((REG4 << 24) | REG4) & static_cast(0x000000FF000000FFull); - REG1 = ((REG1 << 12) | REG1) & glm::uint64(0x000F000F000F000Full); - REG2 = ((REG2 << 12) | REG2) & glm::uint64(0x000F000F000F000Full); - REG3 = ((REG3 << 12) | REG3) & glm::uint64(0x000F000F000F000Full); - REG4 = ((REG4 << 12) | REG4) & glm::uint64(0x000F000F000F000Full); + REG1 = ((REG1 << 12) | REG1) & static_cast(0x000F000F000F000Full); + REG2 = ((REG2 << 12) | REG2) & static_cast(0x000F000F000F000Full); + REG3 = ((REG3 << 12) | REG3) & static_cast(0x000F000F000F000Full); + REG4 = ((REG4 << 12) | REG4) & static_cast(0x000F000F000F000Full); - REG1 = ((REG1 << 6) | REG1) & glm::uint64(0x0303030303030303ull); - REG2 = ((REG2 << 6) | REG2) & glm::uint64(0x0303030303030303ull); - REG3 = ((REG3 << 6) | REG3) & glm::uint64(0x0303030303030303ull); - REG4 = ((REG4 << 6) | REG4) & glm::uint64(0x0303030303030303ull); + REG1 = ((REG1 << 6) | REG1) & static_cast(0x0303030303030303ull); + REG2 = ((REG2 << 6) | REG2) & static_cast(0x0303030303030303ull); + REG3 = ((REG3 << 6) | REG3) & static_cast(0x0303030303030303ull); + REG4 = ((REG4 << 6) | REG4) & static_cast(0x0303030303030303ull); - REG1 = ((REG1 << 3) | REG1) & glm::uint64(0x1111111111111111ull); - REG2 = ((REG2 << 3) | REG2) & glm::uint64(0x1111111111111111ull); - REG3 = ((REG3 << 3) | REG3) & glm::uint64(0x1111111111111111ull); - REG4 = ((REG4 << 3) | REG4) & glm::uint64(0x1111111111111111ull); + REG1 = ((REG1 << 3) | REG1) & static_cast(0x1111111111111111ull); + REG2 = ((REG2 << 3) | REG2) & static_cast(0x1111111111111111ull); + REG3 = ((REG3 << 3) | REG3) & static_cast(0x1111111111111111ull); + REG4 = ((REG4 << 3) | REG4) & static_cast(0x1111111111111111ull); return REG1 | (REG2 << 1) | (REG3 << 2) | (REG4 << 3); } diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index fdb201e8..78d95e8a 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -18,11 +18,13 @@ namespace floor_ { float A = 1.1f; float B = glm::floor(A); + Error += glm::epsilonEqual(B, 1.f, 0.0001f) ? 0 : 1; } { double A = 1.1; double B = glm::floor(A); + Error += glm::epsilonEqual(B, 1.0, 0.0001) ? 0 : 1; } { diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index d1a1ca8a..8e867dae 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -218,12 +218,12 @@ namespace bitfieldReverse GLM_FUNC_QUALIFIER glm::vec bitfieldReverseOps(glm::vec const& v) { glm::vec x(v); - x = compute_bitfieldReverseStep= 2>::call(x, T(0x5555555555555555ull), static_cast( 1)); - x = compute_bitfieldReverseStep= 4>::call(x, T(0x3333333333333333ull), static_cast( 2)); - x = compute_bitfieldReverseStep= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast( 4)); - x = compute_bitfieldReverseStep= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast( 8)); - x = compute_bitfieldReverseStep= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast(16)); - x = compute_bitfieldReverseStep= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast(32)); + x = compute_bitfieldReverseStep= 2>::call(x, static_cast(0x5555555555555555ull), static_cast( 1)); + x = compute_bitfieldReverseStep= 4>::call(x, static_cast(0x3333333333333333ull), static_cast( 2)); + x = compute_bitfieldReverseStep= 8>::call(x, static_cast(0x0F0F0F0F0F0F0F0Full), static_cast( 4)); + x = compute_bitfieldReverseStep= 16>::call(x, static_cast(0x00FF00FF00FF00FFull), static_cast( 8)); + x = compute_bitfieldReverseStep= 32>::call(x, static_cast(0x0000FFFF0000FFFFull), static_cast(16)); + x = compute_bitfieldReverseStep= 64>::call(x, static_cast(0x00000000FFFFFFFFull), static_cast(32)); return x; } @@ -1418,12 +1418,12 @@ namespace bitCount static glm::vec bitCount_bitfield(glm::vec const& v) { glm::vec::type, Q> x(*reinterpret_cast::type, Q> const *>(&v)); - x = compute_bitfieldBitCountStep= 2>::call(x, typename glm::detail::make_unsigned::type(0x5555555555555555ull), typename glm::detail::make_unsigned::type( 1)); - x = compute_bitfieldBitCountStep= 4>::call(x, typename glm::detail::make_unsigned::type(0x3333333333333333ull), typename glm::detail::make_unsigned::type( 2)); - x = compute_bitfieldBitCountStep= 8>::call(x, typename glm::detail::make_unsigned::type(0x0F0F0F0F0F0F0F0Full), typename glm::detail::make_unsigned::type( 4)); - x = compute_bitfieldBitCountStep= 16>::call(x, typename glm::detail::make_unsigned::type(0x00FF00FF00FF00FFull), typename glm::detail::make_unsigned::type( 8)); - x = compute_bitfieldBitCountStep= 32>::call(x, typename glm::detail::make_unsigned::type(0x0000FFFF0000FFFFull), typename glm::detail::make_unsigned::type(16)); - x = compute_bitfieldBitCountStep= 64>::call(x, typename glm::detail::make_unsigned::type(0x00000000FFFFFFFFull), typename glm::detail::make_unsigned::type(32)); + x = compute_bitfieldBitCountStep= 2>::call(x, static_cast::type>(0x5555555555555555ull), static_cast::type>( 1)); + x = compute_bitfieldBitCountStep= 4>::call(x, static_cast::type>(0x3333333333333333ull), static_cast::type>( 2)); + x = compute_bitfieldBitCountStep= 8>::call(x, static_cast::type>(0x0F0F0F0F0F0F0F0Full), static_cast::type>( 4)); + x = compute_bitfieldBitCountStep= 16>::call(x, static_cast::type>(0x00FF00FF00FF00FFull), static_cast::type>( 8)); + x = compute_bitfieldBitCountStep= 32>::call(x, static_cast::type>(0x0000FFFF0000FFFFull), static_cast::type>(16)); + x = compute_bitfieldBitCountStep= 64>::call(x, static_cast::type>(0x00000000FFFFFFFFull), static_cast::type>(32)); return glm::vec(x); } diff --git a/test/core/core_func_noise.cpp b/test/core/core_func_noise.cpp index 2bbf3fb3..4f0b4300 100644 --- a/test/core/core_func_noise.cpp +++ b/test/core/core_func_noise.cpp @@ -1,22 +1,7 @@ -struct vec4 -{ - static int length(); -}; - -int vec4::length() -{ - return 4; -} - int main() { - int Failed = 0; + int Error = 0; - vec4 V; - - int LengthA = V.length(); - int LengthB = vec4::length(); - - return Failed; + return Error; } diff --git a/test/gtc/gtc_bitfield.cpp b/test/gtc/gtc_bitfield.cpp index 1c262897..5dbd0dc4 100644 --- a/test/gtc/gtc_bitfield.cpp +++ b/test/gtc/gtc_bitfield.cpp @@ -124,7 +124,7 @@ namespace mask {32, 0xffffffff} }; - int Error(0); + int Error = 0; /* mask_zero is sadly not a correct code for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { @@ -495,6 +495,9 @@ namespace bitfieldInterleave glm::uint64 B(glm::bitfieldInterleave(glm::uint16(x), glm::uint16(y))); glm::uint64 C(glm::bitfieldInterleave(glm::uint32(x), glm::uint32(y))); + assert(A == B); + assert(A == C); + glm::int64 D(glm::bitfieldInterleave(glm::int8(x), glm::int8(y))); glm::int64 E(glm::bitfieldInterleave(glm::int16(x), glm::int16(y))); glm::int64 F(glm::bitfieldInterleave(glm::int32(x), glm::int32(y))); @@ -675,10 +678,10 @@ namespace bitfieldInterleave5 GLM_FUNC_QUALIFIER glm::uint32 bitfieldInterleave_u16vec2(glm::uint16 x, glm::uint16 y) { glm::uint64 Result = (glm::uint64(y) << 32) | glm::uint64(x); - Result = ((Result << 8) | Result) & glm::uint32(0x00FF00FF00FF00FFull); - Result = ((Result << 4) | Result) & glm::uint32(0x0F0F0F0F0F0F0F0Full); - Result = ((Result << 2) | Result) & glm::uint32(0x3333333333333333ull); - Result = ((Result << 1) | Result) & glm::uint32(0x5555555555555555ull); + Result = ((Result << 8) | Result) & static_cast(0x00FF00FF00FF00FFull); + Result = ((Result << 4) | Result) & static_cast(0x0F0F0F0F0F0F0F0Full); + Result = ((Result << 2) | Result) & static_cast(0x3333333333333333ull); + Result = ((Result << 1) | Result) & static_cast(0x5555555555555555ull); return static_cast((Result & 0x00000000FFFFFFFFull) | (Result >> 31)); } diff --git a/test/gtc/gtc_constants.cpp b/test/gtc/gtc_constants.cpp index 65903e9e..3897cd08 100644 --- a/test/gtc/gtc_constants.cpp +++ b/test/gtc/gtc_constants.cpp @@ -2,14 +2,16 @@ int test_epsilon() { - int Error(0); + int Error = 0; { float Test = glm::epsilon(); + Error += Test > 0.0f ? 0 : 1; } { double Test = glm::epsilon(); + Error += Test > 0.0 ? 0 : 1; } return Error; diff --git a/test/gtc/gtc_packing.cpp b/test/gtc/gtc_packing.cpp index 4b7e4de7..d8ad8da6 100644 --- a/test/gtc/gtc_packing.cpp +++ b/test/gtc/gtc_packing.cpp @@ -271,7 +271,7 @@ int test_RGBM() for(std::size_t i = 0; i < 1024; ++i) { - glm::vec3 const Color(i); + glm::vec3 const Color(static_cast(i)); glm::vec4 const RGBM = glm::packRGBM(Color); glm::vec3 const Result= glm::unpackRGBM(RGBM); diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 3ea8b3fa..f94adf5d 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -107,7 +107,7 @@ int test_quat_normalize() int test_quat_euler() { - int Error(0); + int Error = 0; { glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); @@ -115,6 +115,7 @@ int test_quat_euler() float Pitch = glm::pitch(q); float Yaw = glm::yaw(q); glm::vec3 Angles = glm::eulerAngles(q); + Error += glm::all(glm::epsilonEqual(Angles, glm::vec3(Pitch, Yaw, Roll), 0.000001f)) ? 0 : 1; } { @@ -123,6 +124,7 @@ int test_quat_euler() double Pitch = glm::pitch(q); double Yaw = glm::yaw(q); glm::dvec3 Angles = glm::eulerAngles(q); + Error += glm::all(glm::epsilonEqual(Angles, glm::dvec3(Pitch, Yaw, Roll), 0.000001)) ? 0 : 1; } return Error; @@ -130,7 +132,7 @@ int test_quat_euler() int test_quat_slerp() { - int Error(0); + int Error = 0; float const Epsilon = 0.0001f;//glm::epsilon(); @@ -236,14 +238,6 @@ int test_quat_two_axis_ctr() return Error; } -int test_quat_type() -{ - glm::quat A; - glm::dquat B; - - return 0; -} - int test_quat_mul_vec() { int Error(0); @@ -310,7 +304,6 @@ int main() Error += test_quat_two_axis_ctr(); Error += test_quat_mul(); Error += test_quat_precision(); - Error += test_quat_type(); Error += test_quat_angle(); Error += test_quat_angleAxis(); Error += test_quat_mix(); diff --git a/test/gtc/gtc_type_aligned.cpp b/test/gtc/gtc_type_aligned.cpp index 4c7b482d..29c4a3d7 100644 --- a/test/gtc/gtc_type_aligned.cpp +++ b/test/gtc/gtc_type_aligned.cpp @@ -130,17 +130,6 @@ int main() { int Error = 0; - my_vec4_aligned GNA; - my_dvec4_aligned GNI; - - std::size_t A0 = sizeof(my_dvec4_aligned); - std::size_t B0 = sizeof(my_dvec4_packed); - std::size_t C0 = sizeof(glm::aligned_dvec4); - - std::size_t A1 = sizeof(my_vec4_aligned); - std::size_t B1 = sizeof(my_vec4_packed); - std::size_t C1 = sizeof(glm::aligned_vec4); - Error += test_ctor(); Error += test_copy(); diff --git a/test/gtx/gtx_common.cpp b/test/gtx/gtx_common.cpp index 0ac8e72e..1602681b 100644 --- a/test/gtx/gtx_common.cpp +++ b/test/gtx/gtx_common.cpp @@ -106,13 +106,22 @@ namespace fmod_ int test_isdenormal() { - int Error(0); + int Error = 0; bool A = glm::isdenormal(1.0f); + Error += !A ? 0 : 1; + glm::bvec1 B = glm::isdenormal(glm::vec1(1.0f)); + Error += !glm::any(B) ? 0 : 1; + glm::bvec2 C = glm::isdenormal(glm::vec2(1.0f)); + Error += !glm::any(C) ? 0 : 1; + glm::bvec3 D = glm::isdenormal(glm::vec3(1.0f)); + Error += !glm::any(D) ? 0 : 1; + glm::bvec4 E = glm::isdenormal(glm::vec4(1.0f)); + Error += !glm::any(E) ? 0 : 1; return Error; } diff --git a/test/gtx/gtx_matrix_interpolation.cpp b/test/gtx/gtx_matrix_interpolation.cpp index e35fa100..b380ba15 100644 --- a/test/gtx/gtx_matrix_interpolation.cpp +++ b/test/gtx/gtx_matrix_interpolation.cpp @@ -8,7 +8,6 @@ int test_axisAngle() { int Error = 0; - float p = 0.171654f; glm::mat4 m1(-0.9946f, 0.0f, -0.104531f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.104531f, 0.0f, -0.9946f, 0.0f, diff --git a/test/gtx/gtx_quaternion.cpp b/test/gtx/gtx_quaternion.cpp index e27981c4..164cbf2a 100644 --- a/test/gtx/gtx_quaternion.cpp +++ b/test/gtx/gtx_quaternion.cpp @@ -43,21 +43,24 @@ int test_quat_shortMix() int test_orientation() { - int Error(0); + int Error = 0; { glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); float p = glm::roll(q); + Error += glm::epsilonEqual(p, glm::pi() * 0.5f, 0.0001f) ? 0 : 1; } { glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); float p = glm::pitch(q); + Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1; } { glm::quat q(1.0f, 0.0f, 0.0f, 1.0f); float p = glm::yaw(q); + Error += glm::epsilonEqual(p, 0.f, 0.0001f) ? 0 : 1; } return Error; @@ -113,6 +116,7 @@ int main() Error += test_log(); Error += test_rotation(); + Error += test_orientation(); Error += test_quat_fastMix(); Error += test_quat_shortMix(); Error += test_quat_lookAt(); diff --git a/test/gtx/gtx_range.cpp b/test/gtx/gtx_range.cpp index d93d64d4..d4b9fa40 100644 --- a/test/gtx/gtx_range.cpp +++ b/test/gtx/gtx_range.cpp @@ -6,40 +6,68 @@ #include -int testVec() +int test_vec() { - int Error(0); - glm::vec3 v(1, 2, 3); + int Error = 0; - int count = 0; - for(float x : v){ count++; } - Error += count == 3 ? 0 : 1; + { + glm::ivec3 const v(1, 2, 3); + + int count = 0; + glm::ivec3 Result(0); + for(int x : v) + { + Result[count] = x; + count++; + } + Error += count == 3 ? 0 : 1; + Error += v == Result ? 0 : 1; + } + + { + glm::ivec3 v(1, 2, 3); + for(int& x : v) + x = 0; + Error += glm::all(glm::equal(v, glm::ivec3(0))) ? 0 : 1; + } - for(float& x : v){ x = 0; } - Error += glm::all(glm::equal(v, glm::vec3(0, 0, 0))) ? 0 : 1; return Error; } -int testMat() +int test_mat() { - int Error(0); - glm::mat4x3 m(1); + int Error = 0; - int count = 0; - for(float x : m){ count++; } - Error += count == 12 ? 0 : 1; + { + glm::mat4x3 m(1.0f); + + int count = 0; + float Sum = 0.0f; + for(float x : m) + { + count++; + Sum += x; + } + Error += count == 12 ? 0 : 1; + Error += glm::epsilonEqual(Sum, 3.0f, 0.001f) ? 0 : 1; + } + + { + glm::mat4x3 m(1.0f); + + for (float& x : m) { x = 0; } + glm::vec4 v(1, 1, 1, 1); + Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1; + } - for(float& x : m){ x = 0; } - glm::vec4 v(1, 1, 1, 1); - Error += glm::all(glm::equal(m*v, glm::vec3(0, 0, 0))) ? 0 : 1; return Error; } int main() { - int Error(0); - Error += testVec(); - Error += testMat(); + int Error = 0; + Error += test_vec(); + Error += test_mat(); return Error; }