From 1c68cee29bbd4dd8c69ffa5de08daf42aa5d6e5f Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 12 May 2013 11:40:25 +0200 Subject: [PATCH] Clean up code test for branch compatibility on all platforms --- glm/core/dummy.cpp | 7 +++++++ glm/core/type_mat4x4.inl | 22 +++++++++++----------- test/core/core_func_swizzle.cpp | 14 +++++++------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/glm/core/dummy.cpp b/glm/core/dummy.cpp index 88502490..e369d625 100644 --- a/glm/core/dummy.cpp +++ b/glm/core/dummy.cpp @@ -32,6 +32,7 @@ #define GLM_MESSAGES #include "../glm.hpp" +#if(GLM_ARCH & GLM_ARCH_SSE2) struct float4 { union @@ -52,11 +53,17 @@ int test_simd() return 0; } +#endif//GLM_ARCH + int main() { glm::mat4 A(1.0f); glm::vec4 B(1.0f); glm::vec4 C = A * B; + +# if(GLM_ARCH & GLM_ARCH_SSE2) + test_simd(); +# endif return 0; } diff --git a/glm/core/type_mat4x4.inl b/glm/core/type_mat4x4.inl index df911608..9e613d0f 100644 --- a/glm/core/type_mat4x4.inl +++ b/glm/core/type_mat4x4.inl @@ -727,17 +727,17 @@ namespace detail return typename tmat4x4::col_type(a2); */ - tmat4x4::col_type const Mov0(v[0]); - tmat4x4::col_type const Mov1(v[1]); - tmat4x4::col_type const Mul0 = m[0] * Mov0; - tmat4x4::col_type const Mul1 = m[1] * Mov1; - tmat4x4::col_type const Add0 = Mul0 * Mul1; - tmat4x4::col_type const Mov2(v[2]); - tmat4x4::col_type const Mov3(v[3]); - tmat4x4::col_type const Mul2 = m[2] * Mov2; - tmat4x4::col_type const Mul3 = m[3] * Mov3; - tmat4x4::col_type const Add1 = Mul2 * Mul3; - tmat4x4::col_type const Add2 = Add0 * Add1; + typename tmat4x4::col_type const Mov0(v[0]); + typename tmat4x4::col_type const Mov1(v[1]); + typename tmat4x4::col_type const Mul0 = m[0] * Mov0; + typename tmat4x4::col_type const Mul1 = m[1] * Mov1; + typename tmat4x4::col_type const Add0 = Mul0 * Mul1; + typename tmat4x4::col_type const Mov2(v[2]); + typename tmat4x4::col_type const Mov3(v[3]); + typename tmat4x4::col_type const Mul2 = m[2] * Mov2; + typename tmat4x4::col_type const Mul3 = m[3] * Mov3; + typename tmat4x4::col_type const Add1 = Mul2 * Mul3; + typename tmat4x4::col_type const Add2 = Add0 * Add1; return Add2; /* diff --git a/test/core/core_func_swizzle.cpp b/test/core/core_func_swizzle.cpp index 08aacad4..20351dd7 100644 --- a/test/core/core_func_swizzle.cpp +++ b/test/core/core_func_swizzle.cpp @@ -28,7 +28,7 @@ int test_vec2_swizzle() { int Error = 0; - glm::ivec2 A(1, 2); + glm::ivec2 A(1, 2); glm::ivec2 B = A.xy(); glm::ivec2 C(0); C.xy() = B.xy(); @@ -43,7 +43,7 @@ int test_vec3_swizzle() { int Error = 0; - glm::ivec3 A(1, 2, 3); + glm::ivec3 A(1, 2, 3); glm::ivec3 B = A.xyz(); glm::ivec3 C(0); C.xyz() = B.xyz(); @@ -58,7 +58,7 @@ int test_vec4_swizzle() { int Error = 0; - glm::ivec4 A(1, 2, 3, 4); + glm::ivec4 A(1, 2, 3, 4); glm::ivec4 B = A.xyzw(); glm::ivec4 C(0); C.xyzw() = B.xyzw(); @@ -71,12 +71,12 @@ int test_vec4_swizzle() int main() { - int Error = 0; - + int Error = 0; + Error += test_vec2_swizzle(); Error += test_vec3_swizzle(); - Error += test_vec4_swizzle(); - + Error += test_vec4_swizzle(); + return Error; }