Browse Source

Added GLM_HAS_TRIVIAL_QUERIES define

Christophe Riccio 11 years ago
parent
commit
b90c4c430e

+ 4 - 0
glm/detail/setup.hpp

@@ -531,6 +531,10 @@
 	(GLM_LANG & GLM_LANG_CXX11_FLAG) || \
 	((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49)))
 
+#define GLM_HAS_TRIVIAL_QUERIES (\
+	((GLM_LANG & GLM_LANG_CXX11_FLAG) && !(GLM_COMPILER & GLM_COMPILER_GCC)) || \
+	((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)))
+
 // OpenMP
 #ifdef _OPENMP 
 #	if GLM_COMPILER & GLM_COMPILER_GCC

+ 2 - 2
glm/gtc/round.inl

@@ -295,8 +295,8 @@ namespace detail
 		if(isPowerOfTwo(value))
 			return value;
 
-		genType const prev = highestBitValue(value);
-		genType const next = prev << 1;
+		genIUType const prev = highestBitValue(value);
+		genIUType const next = prev << 1;
 		return (next - value) < (value - prev) ? next : prev;
 	}
 

+ 1 - 1
test/core/core_type_mat4x4.cpp

@@ -188,7 +188,7 @@ int test_ctr()
 {
 	int Error(0);
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
+#if GLM_HAS_TRIVIAL_QUERIES
 	//Error += std::is_trivially_default_constructible<glm::mat4>::value ? 0 : 1;
 	//Error += std::is_trivially_copy_assignable<glm::mat4>::value ? 0 : 1;
 	Error += std::is_trivially_copyable<glm::mat4>::value ? 0 : 1;

+ 10 - 10
test/core/core_type_vec1.cpp

@@ -44,16 +44,16 @@ int test_vec1_ctor()
 {
 	int Error = 0;
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
-//	Error += std::is_trivially_default_constructible<glm::vec1>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::vec1>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::vec1>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dvec1>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::ivec1>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::uvec1>::value ? 0 : 1;
-
-	Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
-#endif
+#	if GLM_HAS_TRIVIAL_QUERIES
+	//	Error += std::is_trivially_default_constructible<glm::vec1>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::vec1>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::vec1>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dvec1>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::ivec1>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::uvec1>::value ? 0 : 1;
+
+		Error += std::is_copy_constructible<glm::vec1>::value ? 0 : 1;
+#	endif
 
 /*
 #if GLM_HAS_INITIALIZER_LISTS

+ 9 - 9
test/core/core_type_vec2.cpp

@@ -202,16 +202,16 @@ int test_vec2_ctor()
 {
 	int Error = 0;
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
-//	Error += std::is_trivially_default_constructible<glm::vec2>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::vec2>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::vec2>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dvec2>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::ivec2>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::uvec2>::value ? 0 : 1;
+#	if GLM_HAS_TRIVIAL_QUERIES
+	//	Error += std::is_trivially_default_constructible<glm::vec2>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::vec2>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::vec2>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dvec2>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::ivec2>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::uvec2>::value ? 0 : 1;
 
-	Error += std::is_copy_constructible<glm::vec2>::value ? 0 : 1;
-#endif
+		Error += std::is_copy_constructible<glm::vec2>::value ? 0 : 1;
+#	endif
 
 #if GLM_HAS_INITIALIZER_LISTS
 	{

+ 10 - 10
test/core/core_type_vec3.cpp

@@ -20,16 +20,16 @@ int test_vec3_ctor()
 {
 	int Error = 0;
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
-//	Error += std::is_trivially_default_constructible<glm::vec3>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::vec3>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::vec3>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dvec3>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::ivec3>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::uvec3>::value ? 0 : 1;
-
-	Error += std::is_copy_constructible<glm::vec3>::value ? 0 : 1;
-#endif
+#	if GLM_HAS_TRIVIAL_QUERIES
+	//	Error += std::is_trivially_default_constructible<glm::vec3>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::vec3>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::vec3>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dvec3>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::ivec3>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::uvec3>::value ? 0 : 1;
+
+		Error += std::is_copy_constructible<glm::vec3>::value ? 0 : 1;
+#	endif
 
 #if (GLM_HAS_INITIALIZER_LISTS)
 	{

+ 10 - 10
test/core/core_type_vec4.cpp

@@ -49,16 +49,16 @@ int test_vec4_ctor()
 		Error += glm::all(glm::equal(A, B)) ? 0 : 1;
 	}
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
-//	Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::vec4>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::vec4>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dvec4>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::ivec4>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1;
-
-	Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1;
-#endif
+#	if GLM_HAS_TRIVIAL_QUERIES
+	//	Error += std::is_trivially_default_constructible<glm::vec4>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::vec4>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::vec4>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dvec4>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::ivec4>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::uvec4>::value ? 0 : 1;
+
+		Error += std::is_copy_constructible<glm::vec4>::value ? 0 : 1;
+#	endif
 
 #if GLM_HAS_INITIALIZER_LISTS
 	{

+ 11 - 11
test/gtc/gtc_quaternion.cpp

@@ -273,17 +273,17 @@ int test_quat_ctr()
 {
 	int Error(0);
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
-//	Error += std::is_trivially_default_constructible<glm::quat>::value ? 0 : 1;
-//	Error += std::is_trivially_default_constructible<glm::dquat>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::quat>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::dquat>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1;
-
-	Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1;
-	Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1;
-#endif
+#	if GLM_HAS_TRIVIAL_QUERIES
+	//	Error += std::is_trivially_default_constructible<glm::quat>::value ? 0 : 1;
+	//	Error += std::is_trivially_default_constructible<glm::dquat>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::quat>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::dquat>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::quat>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dquat>::value ? 0 : 1;
+
+		Error += std::is_copy_constructible<glm::quat>::value ? 0 : 1;
+		Error += std::is_copy_constructible<glm::dquat>::value ? 0 : 1;
+#	endif
 
 #	if GLM_HAS_INITIALIZER_LISTS
 	{

+ 11 - 11
test/gtx/gtx_dual_quaternion.cpp

@@ -166,17 +166,17 @@ int test_dual_quat_ctr()
 {
 	int Error(0);
 
-#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12)
-//	Error += std::is_trivially_default_constructible<glm::dualquat>::value ? 0 : 1;
-//	Error += std::is_trivially_default_constructible<glm::ddualquat>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::dualquat>::value ? 0 : 1;
-//	Error += std::is_trivially_copy_assignable<glm::ddualquat>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::dualquat>::value ? 0 : 1;
-	Error += std::is_trivially_copyable<glm::ddualquat>::value ? 0 : 1;
-
-	Error += std::is_copy_constructible<glm::dualquat>::value ? 0 : 1;
-	Error += std::is_copy_constructible<glm::ddualquat>::value ? 0 : 1;
-#endif
+#	if GLM_HAS_TRIVIAL_QUERIES
+	//	Error += std::is_trivially_default_constructible<glm::dualquat>::value ? 0 : 1;
+	//	Error += std::is_trivially_default_constructible<glm::ddualquat>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::dualquat>::value ? 0 : 1;
+	//	Error += std::is_trivially_copy_assignable<glm::ddualquat>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::dualquat>::value ? 0 : 1;
+		Error += std::is_trivially_copyable<glm::ddualquat>::value ? 0 : 1;
+
+		Error += std::is_copy_constructible<glm::dualquat>::value ? 0 : 1;
+		Error += std::is_copy_constructible<glm::ddualquat>::value ? 0 : 1;
+#	endif
 
 	return Error;
 }