From 8c55a64fdd7b8fe6a72d70f5449b8469cfbab379 Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 19 Dec 2015 19:22:33 -0500 Subject: [PATCH 1/2] Fixed ldexp compilation error --- glm/detail/func_common.inl | 2 +- readme.md | 2 +- test/core/core_func_common.cpp | 48 ++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index c3982e82..6b78b2b4 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -706,7 +706,7 @@ namespace detail frexp(x.w, exp.w)); } - template + template GLM_FUNC_QUALIFIER genType ldexp(genType const & x, int const & exp) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'ldexp' only accept floating-point inputs"); diff --git a/readme.md b/readme.md index 2b4c91d1..bda461a9 100644 --- a/readme.md +++ b/readme.md @@ -69,7 +69,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) ##### Fixes: - Fixed GTX_extended_min_max filename typo #386 - Fixed intersectRayTriangle to not do any unintentional backface culling -- Fixed frexp compilation error +- Fixed ldexp and frexp compilation errors #### [GLM 0.9.7.2](https://github.com/g-truc/glm/tree/0.9.7) - 2015-XX-XX ##### Fixes: diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 6b9940b8..780151e5 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1195,6 +1195,53 @@ namespace frexp_ } }//namespace frexp_ +namespace ldexp_ +{ + int test() + { + int Error(0); + + { + glm::vec1 A = glm::vec1(0.5); + glm::ivec1 exp = glm::ivec1(11); + glm::vec1 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec1(1024),0.00001f)) ? 0 : 1; + } + + { + glm::vec2 A = glm::vec2(0.5, 0.96); + glm::ivec2 exp = glm::ivec2(11, -2); + glm::vec2 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec2(1024, .24),0.00001f)) ? 0 : 1; + } + + { + glm::vec3 A = glm::vec3(0.5, 0.96, 0.0); + glm::ivec3 exp = glm::ivec3(11, -2, 0); + glm::vec3 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec3(1024, .24, 0),0.00001f)) ? 0 : 1; + } + + { + glm::vec4 A = glm::vec4(0.5, 0.96, 0.0, -0.665); + glm::ivec4 exp = glm::ivec4(11, -2, 0, 1); + glm::vec4 x = glm::ldexp(A, exp); + Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 0 : 1; + } + + + { + glm::vec4 x(1024, 0.24, 0, -1.33); + glm::ivec4 exp; + glm::vec4 A = glm::frexp(x, exp); + Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; + Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; + } + + return Error; + } +}//namespace ldexp_ + int main() { int Error(0); @@ -1214,6 +1261,7 @@ int main() Error += isnan_::test(); Error += isinf_::test(); Error += frexp_::test(); + Error += ldexp_::test(); # ifdef NDEBUG std::size_t Samples = 1000; From ac7ae328560225443e46f9168e13dcb00524f96b Mon Sep 17 00:00:00 2001 From: humbletim Date: Sat, 19 Dec 2015 19:30:00 -0500 Subject: [PATCH 2/2] remove extraneous test block --- test/core/core_func_common.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index 780151e5..a610dd51 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -1229,15 +1229,6 @@ namespace ldexp_ Error += glm::all(glm::epsilonEqual(x, glm::vec4(1024, .24, 0, -1.33),0.00001f)) ? 0 : 1; } - - { - glm::vec4 x(1024, 0.24, 0, -1.33); - glm::ivec4 exp; - glm::vec4 A = glm::frexp(x, exp); - Error += glm::all(glm::epsilonEqual(A, glm::vec4(0.5, 0.96, 0.0, -0.665), 0.00001f)) ? 0 : 1; - Error += glm::all(glm::equal(exp, glm::ivec4(11, -2, 0, 1))) ? 0 : 1; - } - return Error; } }//namespace ldexp_