Browse Source

Clean up code test for branch compatibility on all platforms

Christophe Riccio 12 years ago
parent
commit
1c68cee29b
3 changed files with 25 additions and 18 deletions
  1. 7 0
      glm/core/dummy.cpp
  2. 11 11
      glm/core/type_mat4x4.inl
  3. 7 7
      test/core/core_func_swizzle.cpp

+ 7 - 0
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;
 }

+ 11 - 11
glm/core/type_mat4x4.inl

@@ -727,17 +727,17 @@ namespace detail
 		return typename tmat4x4<T, P>::col_type(a2);
 */
 
-		tmat4x4<T, P>::col_type const Mov0(v[0]);
-		tmat4x4<T, P>::col_type const Mov1(v[1]);
-		tmat4x4<T, P>::col_type const Mul0 = m[0] * Mov0;
-		tmat4x4<T, P>::col_type const Mul1 = m[1] * Mov1;
-		tmat4x4<T, P>::col_type const Add0 = Mul0 * Mul1;
-		tmat4x4<T, P>::col_type const Mov2(v[2]);
-		tmat4x4<T, P>::col_type const Mov3(v[3]);
-		tmat4x4<T, P>::col_type const Mul2 = m[2] * Mov2;
-		tmat4x4<T, P>::col_type const Mul3 = m[3] * Mov3;
-		tmat4x4<T, P>::col_type const Add1 = Mul2 * Mul3;
-		tmat4x4<T, P>::col_type const Add2 = Add0 * Add1;
+		typename tmat4x4<T, P>::col_type const Mov0(v[0]);
+		typename tmat4x4<T, P>::col_type const Mov1(v[1]);
+		typename tmat4x4<T, P>::col_type const Mul0 = m[0] * Mov0;
+		typename tmat4x4<T, P>::col_type const Mul1 = m[1] * Mov1;
+		typename tmat4x4<T, P>::col_type const Add0 = Mul0 * Mul1;
+		typename tmat4x4<T, P>::col_type const Mov2(v[2]);
+		typename tmat4x4<T, P>::col_type const Mov3(v[3]);
+		typename tmat4x4<T, P>::col_type const Mul2 = m[2] * Mov2;
+		typename tmat4x4<T, P>::col_type const Mul3 = m[3] * Mov3;
+		typename tmat4x4<T, P>::col_type const Add1 = Mul2 * Mul3;
+		typename tmat4x4<T, P>::col_type const Add2 = Add0 * Add1;
 		return Add2;
 
 /*

+ 7 - 7
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;
 }