From 931e72b4568613aa7cd084b56a0908c1fedfb6ba Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 4 Nov 2014 00:52:16 +0100 Subject: [PATCH 1/7] Initial std trivial experiments #263 --- glm/detail/setup.hpp | 4 ++++ glm/detail/type_vec4.hpp | 4 ++-- glm/detail/type_vec4.inl | 8 ++++---- test/core/core_type_mat4x4.cpp | 2 ++ test/core/core_type_vec4.cpp | 14 +++++++++++++- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 78dd193a..578e95ed 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -527,6 +527,10 @@ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ __has_feature(cxx_range_for)) +#define GLM_HAS_ASSIGNABLE ( \ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC49))) + // OpenMP #ifdef _OPENMP # if GLM_COMPILER & GLM_COMPILER_GCC diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index f92b6a38..eae3d3e4 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -148,7 +148,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); - GLM_FUNC_DECL tvec4(tvec4 const & v); + //GLM_FUNC_DECL tvec4(tvec4 const & v); template GLM_FUNC_DECL tvec4(tvec4 const & v); @@ -258,7 +258,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); + //GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); template GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); diff --git a/glm/detail/type_vec4.inl b/glm/detail/type_vec4.inl index 04e9b8cf..97ada0b7 100644 --- a/glm/detail/type_vec4.inl +++ b/glm/detail/type_vec4.inl @@ -84,7 +84,7 @@ namespace glm # endif {} #endif - +/* template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) : x(v.x), y(v.y), z(v.z), w(v.w) @@ -101,7 +101,7 @@ namespace glm : data(v.data) {} #endif - +*/ template template GLM_FUNC_QUALIFIER tvec4::tvec4(tvec4 const & v) @@ -283,7 +283,7 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - +/* template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator=(tvec4 const & v) { @@ -309,7 +309,7 @@ namespace glm return *this; } #endif - +*/ template template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator=(tvec4 const & v) diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index bda125c0..a7a94ed7 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -188,6 +188,8 @@ int test_ctr() { int Error(0); + Error += std::is_copy_constructible::value ? 0 : 1; + #if(GLM_HAS_INITIALIZER_LISTS) glm::mat4 m0( glm::vec4(0, 1, 2, 3), diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 0c5e92ff..4a308883 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -42,7 +42,19 @@ enum comp int test_vec4_ctor() { int Error = 0; - + + glm::ivec4 A(1, 2, 3, 4); + glm::ivec4 B(A); + Error += glm::all(glm::equal(A, B)) ? 0 : 1; + + Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + + Error += std::has_trivial_copy_constructor::value ? 0 : 1; + Error += std::is_copy_constructible::value ? 0 : 1; + #if GLM_HAS_INITIALIZER_LISTS { glm::vec4 a{ 0, 1, 2, 3 }; From a2a6037ba545869f0988e98dae262bf64d0514b1 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 4 Nov 2014 01:06:16 +0100 Subject: [PATCH 2/7] More std trivial experiments #263 --- glm/detail/type_vec4.hpp | 1 + test/core/core_type_vec4.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index eae3d3e4..13da72b5 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -158,6 +158,7 @@ namespace detail GLM_FUNC_DECL explicit tvec4(ctor); GLM_FUNC_DECL explicit tvec4(T const & s); GLM_FUNC_DECL tvec4(T const & s0, T const & s1, T const & s2, T const & s3); + GLM_FUNC_DECL ~tvec4(){} ////////////////////////////////////// // Conversion scalar constructors diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 4a308883..17813ce7 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -47,6 +47,7 @@ int test_vec4_ctor() glm::ivec4 B(A); Error += glm::all(glm::equal(A, B)) ? 0 : 1; + Error += std::is_trivially_default_constructible::value ? 0 : 1; Error += std::is_trivially_copy_assignable::value ? 0 : 1; Error += std::is_trivially_copyable::value ? 0 : 1; Error += std::is_trivially_copy_assignable::value ? 0 : 1; From 838bdee3c3adca9de1c351edc5eea372886eea45 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 10 Nov 2014 00:04:47 +0100 Subject: [PATCH 3/7] All *vec* types are copyable #263 --- glm/detail/type_vec1.hpp | 3 --- glm/detail/type_vec1.inl | 12 ------------ glm/detail/type_vec2.hpp | 3 --- glm/detail/type_vec2.inl | 15 +-------------- glm/detail/type_vec3.hpp | 3 --- glm/detail/type_vec3.inl | 14 -------------- glm/detail/type_vec4.hpp | 3 --- 7 files changed, 1 insertion(+), 52 deletions(-) diff --git a/glm/detail/type_vec1.hpp b/glm/detail/type_vec1.hpp index ab8db882..ba6372d3 100644 --- a/glm/detail/type_vec1.hpp +++ b/glm/detail/type_vec1.hpp @@ -102,7 +102,6 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tvec1(); - GLM_FUNC_DECL tvec1(tvec1 const & v); template GLM_FUNC_DECL tvec1(tvec1 const & v); @@ -142,8 +141,6 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); - template GLM_FUNC_DECL tvec1 & operator=(tvec1 const & v); template diff --git a/glm/detail/type_vec1.inl b/glm/detail/type_vec1.inl index d4c5cff2..6932c6dd 100644 --- a/glm/detail/type_vec1.inl +++ b/glm/detail/type_vec1.inl @@ -69,11 +69,6 @@ namespace glm # endif {} - template - GLM_FUNC_QUALIFIER tvec1::tvec1(tvec1 const & v) - : x(v.x) - {} - template template GLM_FUNC_QUALIFIER tvec1::tvec1(tvec1 const & v) @@ -122,13 +117,6 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - template - GLM_FUNC_QUALIFIER tvec1 & tvec1::operator=(tvec1 const & v) - { - this->x = v.x; - return *this; - } - template template GLM_FUNC_QUALIFIER tvec1 & tvec1::operator=(tvec1 const & v) diff --git a/glm/detail/type_vec2.hpp b/glm/detail/type_vec2.hpp index 5817a2f6..e3d77690 100644 --- a/glm/detail/type_vec2.hpp +++ b/glm/detail/type_vec2.hpp @@ -104,7 +104,6 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tvec2(); - GLM_FUNC_DECL tvec2(tvec2 const & v); template GLM_FUNC_DECL tvec2(tvec2 const & v); @@ -151,8 +150,6 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec2 & operator=(tvec2 const & v); - template GLM_FUNC_DECL tvec2 & operator=(tvec2 const & v); template diff --git a/glm/detail/type_vec2.inl b/glm/detail/type_vec2.inl index 7c5eb0b9..9a2326a8 100644 --- a/glm/detail/type_vec2.inl +++ b/glm/detail/type_vec2.inl @@ -64,16 +64,11 @@ namespace glm template GLM_FUNC_QUALIFIER tvec2::tvec2() -# ifndef GLM_FORCE_NO_CTOR_INIT +# ifndef GLM_FORCE_NO_CTOR_INIT : x(0), y(0) # endif {} - template - GLM_FUNC_QUALIFIER tvec2::tvec2(tvec2 const & v) - : x(v.x), y(v.y) - {} - template template GLM_FUNC_QUALIFIER tvec2::tvec2(tvec2 const & v) @@ -141,14 +136,6 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) - { - this->x = v.x; - this->y = v.y; - return *this; - } - template template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator=(tvec2 const & v) diff --git a/glm/detail/type_vec3.hpp b/glm/detail/type_vec3.hpp index 920d8acb..a8abb062 100644 --- a/glm/detail/type_vec3.hpp +++ b/glm/detail/type_vec3.hpp @@ -105,7 +105,6 @@ namespace glm // Implicit basic constructors GLM_FUNC_DECL tvec3(); - GLM_FUNC_DECL tvec3(tvec3 const & v); template GLM_FUNC_DECL tvec3(tvec3 const & v); @@ -173,8 +172,6 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v); - template GLM_FUNC_DECL tvec3 & operator=(tvec3 const & v); template diff --git a/glm/detail/type_vec3.inl b/glm/detail/type_vec3.inl index 6eb56791..75459d7b 100644 --- a/glm/detail/type_vec3.inl +++ b/glm/detail/type_vec3.inl @@ -69,11 +69,6 @@ namespace glm # endif {} - template - GLM_FUNC_QUALIFIER tvec3::tvec3(tvec3 const & v) - : x(v.x), y(v.y), z(v.z) - {} - template template GLM_FUNC_QUALIFIER tvec3::tvec3(tvec3 const & v) @@ -170,15 +165,6 @@ namespace glm ////////////////////////////////////// // Unary arithmetic operators - template - GLM_FUNC_QUALIFIER tvec3& tvec3::operator=(tvec3 const & v) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - return *this; - } - template template GLM_FUNC_QUALIFIER tvec3& tvec3::operator=(tvec3 const & v) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 13da72b5..27cafa33 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -148,7 +148,6 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); - //GLM_FUNC_DECL tvec4(tvec4 const & v); template GLM_FUNC_DECL tvec4(tvec4 const & v); @@ -259,8 +258,6 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators - //GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); - template GLM_FUNC_DECL tvec4 & operator=(tvec4 const & v); template From ee84420f6cfe4771b086c55bff2db1bcc50a67ec Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 10 Nov 2014 01:16:48 +0100 Subject: [PATCH 4/7] All *mat* types are copyable #263 --- glm/detail/type_mat2x2.hpp | 2 -- glm/detail/type_mat2x2.inl | 16 ------------- glm/detail/type_mat2x3.hpp | 2 -- glm/detail/type_mat2x3.inl | 43 +++++++++++----------------------- glm/detail/type_mat2x4.hpp | 2 -- glm/detail/type_mat2x4.inl | 15 ------------ glm/detail/type_mat3x2.hpp | 2 -- glm/detail/type_mat3x2.inl | 17 -------------- glm/detail/type_mat3x3.hpp | 2 -- glm/detail/type_mat3x3.inl | 17 -------------- glm/detail/type_mat3x4.hpp | 2 -- glm/detail/type_mat3x4.inl | 17 -------------- glm/detail/type_mat4x2.hpp | 2 -- glm/detail/type_mat4x2.inl | 19 --------------- glm/detail/type_mat4x3.hpp | 2 -- glm/detail/type_mat4x3.inl | 19 --------------- glm/detail/type_mat4x4.hpp | 4 ++-- glm/detail/type_mat4x4.inl | 21 ----------------- test/core/core_type_mat4x4.cpp | 6 ++++- test/core/core_type_vec4.cpp | 8 +++---- 20 files changed, 25 insertions(+), 193 deletions(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index c17fdc9c..b4cb89d5 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -66,7 +66,6 @@ namespace glm ////////////////////////////////////// // Constructors GLM_FUNC_DECL tmat2x2(); - GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); template GLM_FUNC_DECL tmat2x2(tmat2x2 const & m); @@ -111,7 +110,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & m); template GLM_FUNC_DECL tmat2x2 & operator=(tmat2x2 const & m); template diff --git a/glm/detail/type_mat2x2.inl b/glm/detail/type_mat2x2.inl index df56aac6..95c88c9e 100644 --- a/glm/detail/type_mat2x2.inl +++ b/glm/detail/type_mat2x2.inl @@ -89,13 +89,6 @@ namespace detail # endif } - template - GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(tmat2x2 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - } - template template GLM_FUNC_QUALIFIER tmat2x2::tmat2x2(tmat2x2 const & m) @@ -225,15 +218,6 @@ namespace detail ////////////////////////////////////////////////////////////// // mat2x2 operators - // This function shouldn't required but it seems that VC7.1 have an optimisation bug if this operator wasn't declared - template - GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator=(tmat2x2 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat2x2& tmat2x2::operator=(tmat2x2 const & m) diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index f60282d3..53c5fa4a 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -61,7 +61,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat2x3(); - GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); template GLM_FUNC_DECL tmat2x3(tmat2x3 const & m); @@ -104,7 +103,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat2x3 & operator= (tmat2x3 const & m); template GLM_FUNC_DECL tmat2x3 & operator= (tmat2x3 const & m); template diff --git a/glm/detail/type_mat2x3.inl b/glm/detail/type_mat2x3.inl index 1ed527b5..64813c15 100644 --- a/glm/detail/type_mat2x3.inl +++ b/glm/detail/type_mat2x3.inl @@ -71,13 +71,6 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(tmat2x3 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - } - template template GLM_FUNC_QUALIFIER tmat2x3::tmat2x3(tmat2x3 const & m) @@ -210,15 +203,7 @@ namespace glm // Unary updatable operators template - GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator=(tmat2x3 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - return *this; - } - - template - template + template GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator=(tmat2x3 const & m) { this->value[0] = m[0]; @@ -226,8 +211,8 @@ namespace glm return *this; } - template - template + template + template GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator+=(U s) { this->value[0] += s; @@ -235,8 +220,8 @@ namespace glm return *this; } - template - template + template + template GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator+=(tmat2x3 const & m) { this->value[0] += m[0]; @@ -244,8 +229,8 @@ namespace glm return *this; } - template - template + template + template GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator-=(U s) { this->value[0] -= s; @@ -253,8 +238,8 @@ namespace glm return *this; } - template - template + template + template GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator-=(tmat2x3 const & m) { this->value[0] -= m[0]; @@ -262,8 +247,8 @@ namespace glm return *this; } - template - template + template + template GLM_FUNC_QUALIFIER tmat2x3& tmat2x3::operator*=(U s) { this->value[0] *= s; @@ -272,7 +257,7 @@ namespace glm } template - template + template GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator/=(U s) { this->value[0] /= s; @@ -280,7 +265,7 @@ namespace glm return *this; } - template + template GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator++() { ++this->value[0]; @@ -288,7 +273,7 @@ namespace glm return *this; } - template + template GLM_FUNC_QUALIFIER tmat2x3 & tmat2x3::operator--() { --this->value[0]; diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 28066c04..a30929da 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -61,7 +61,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat2x4(); - GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); template GLM_FUNC_DECL tmat2x4(tmat2x4 const & m); @@ -106,7 +105,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat2x4& operator= (tmat2x4 const & m); template GLM_FUNC_DECL tmat2x4& operator= (tmat2x4 const & m); template diff --git a/glm/detail/type_mat2x4.inl b/glm/detail/type_mat2x4.inl index e45ffc0d..94b46140 100644 --- a/glm/detail/type_mat2x4.inl +++ b/glm/detail/type_mat2x4.inl @@ -71,13 +71,6 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(tmat2x4 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - } - template template GLM_FUNC_QUALIFIER tmat2x4::tmat2x4(tmat2x4 const & m) @@ -210,14 +203,6 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator=(tmat2x4 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat2x4& tmat2x4::operator=(tmat2x4 const & m) diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index a09dca98..762158bc 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -61,7 +61,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat3x2(); - GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); template GLM_FUNC_DECL tmat3x2(tmat3x2 const & m); @@ -110,7 +109,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat3x2 & operator= (tmat3x2 const & m); template GLM_FUNC_DECL tmat3x2 & operator= (tmat3x2 const & m); template diff --git a/glm/detail/type_mat3x2.inl b/glm/detail/type_mat3x2.inl index 026261dd..956bc866 100644 --- a/glm/detail/type_mat3x2.inl +++ b/glm/detail/type_mat3x2.inl @@ -72,14 +72,6 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(tmat3x2 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - } - template template GLM_FUNC_QUALIFIER tmat3x2::tmat3x2(tmat3x2 const & m) @@ -239,15 +231,6 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat3x2& tmat3x2::operator=(tmat3x2 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat3x2& tmat3x2::operator=(tmat3x2 const & m) diff --git a/glm/detail/type_mat3x3.hpp b/glm/detail/type_mat3x3.hpp index d85ea5aa..a7d1409f 100644 --- a/glm/detail/type_mat3x3.hpp +++ b/glm/detail/type_mat3x3.hpp @@ -65,7 +65,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat3x3(); - GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); template GLM_FUNC_DECL tmat3x3(tmat3x3 const & m); @@ -114,7 +113,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat3x3& operator= (tmat3x3 const & m); template GLM_FUNC_DECL tmat3x3& operator= (tmat3x3 const & m); template diff --git a/glm/detail/type_mat3x3.inl b/glm/detail/type_mat3x3.inl index f39baa7d..5fd41d0f 100644 --- a/glm/detail/type_mat3x3.inl +++ b/glm/detail/type_mat3x3.inl @@ -96,14 +96,6 @@ namespace detail # endif } - template - GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(tmat3x3 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - } - template GLM_FUNC_QUALIFIER tmat3x3::tmat3x3(ctor) {} @@ -263,15 +255,6 @@ namespace detail ////////////////////////////////////////////////////////////// // Operators - template - GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator=(tmat3x3 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat3x3 & tmat3x3::operator=(tmat3x3 const & m) diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index c7017704..6c4c7cd5 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -61,7 +61,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat3x4(); - GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); template GLM_FUNC_DECL tmat3x4(tmat3x4 const & m); @@ -110,7 +109,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); template GLM_FUNC_DECL tmat3x4 & operator=(tmat3x4 const & m); template diff --git a/glm/detail/type_mat3x4.inl b/glm/detail/type_mat3x4.inl index cb3fdd39..a8ff77d8 100644 --- a/glm/detail/type_mat3x4.inl +++ b/glm/detail/type_mat3x4.inl @@ -72,14 +72,6 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(tmat3x4 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - } - template template GLM_FUNC_QUALIFIER tmat3x4::tmat3x4(tmat3x4 const & m) @@ -238,15 +230,6 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat3x4& tmat3x4::operator=(tmat3x4 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat3x4& tmat3x4::operator=(tmat3x4 const & m) diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 27097298..a84c83f2 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -61,7 +61,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x2(); - GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); template GLM_FUNC_DECL tmat4x2(tmat4x2 const & m); @@ -116,7 +115,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat4x2& operator=(tmat4x2 const & m); template GLM_FUNC_DECL tmat4x2& operator=(tmat4x2 const & m); template diff --git a/glm/detail/type_mat4x2.inl b/glm/detail/type_mat4x2.inl index 3090a8bd..b81bd747 100644 --- a/glm/detail/type_mat4x2.inl +++ b/glm/detail/type_mat4x2.inl @@ -73,15 +73,6 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - this->value[3] = m.value[3]; - } - template template GLM_FUNC_QUALIFIER tmat4x2::tmat4x2(tmat4x2 const & m) @@ -262,16 +253,6 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat4x2& tmat4x2::operator=(tmat4x2 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat4x2& tmat4x2::operator=(tmat4x2 const & m) diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index ad7f015f..f108052b 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -60,7 +60,6 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x3(); - GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); template GLM_FUNC_DECL tmat4x3(tmat4x3 const & m); @@ -115,7 +114,6 @@ namespace glm GLM_FUNC_DECL col_type & operator[](size_type i); GLM_FUNC_DECL col_type const & operator[](size_type i) const; - GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); template GLM_FUNC_DECL tmat4x3 & operator=(tmat4x3 const & m); template diff --git a/glm/detail/type_mat4x3.inl b/glm/detail/type_mat4x3.inl index 8ac1a3c6..dd49c231 100644 --- a/glm/detail/type_mat4x3.inl +++ b/glm/detail/type_mat4x3.inl @@ -73,15 +73,6 @@ namespace glm # endif } - template - GLM_FUNC_QUALIFIER tmat4x3::tmat4x3(tmat4x3 const & m) - { - this->value[0] = m.value[0]; - this->value[1] = m.value[1]; - this->value[2] = m.value[2]; - this->value[3] = m.value[3]; - } - template template GLM_FUNC_QUALIFIER tmat4x3::tmat4x3(tmat4x3 const & m) @@ -262,16 +253,6 @@ namespace glm ////////////////////////////////////////////////////////////// // Unary updatable operators - template - GLM_FUNC_QUALIFIER tmat4x3& tmat4x3::operator=(tmat4x3 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat4x3& tmat4x3::operator=(tmat4x3 const & m) diff --git a/glm/detail/type_mat4x4.hpp b/glm/detail/type_mat4x4.hpp index cdbfd3d4..61e4e7bb 100644 --- a/glm/detail/type_mat4x4.hpp +++ b/glm/detail/type_mat4x4.hpp @@ -65,7 +65,7 @@ namespace glm public: // Constructors GLM_FUNC_DECL tmat4x4(); - GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); + //GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); template GLM_FUNC_DECL tmat4x4(tmat4x4 const & m); @@ -120,7 +120,7 @@ namespace glm GLM_FUNC_DECL col_type & operator[](length_t i); GLM_FUNC_DECL col_type const & operator[](length_t i) const; - GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); + //GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); template GLM_FUNC_DECL tmat4x4 & operator=(tmat4x4 const & m); template diff --git a/glm/detail/type_mat4x4.inl b/glm/detail/type_mat4x4.inl index 3b488eff..6a1a0cd2 100644 --- a/glm/detail/type_mat4x4.inl +++ b/glm/detail/type_mat4x4.inl @@ -132,15 +132,6 @@ namespace detail this->value[3] = col_type(0, 0, 0, 1); # endif } - - template - GLM_FUNC_QUALIFIER tmat4x4::tmat4x4(tmat4x4 const & m) - { - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - } template template @@ -348,18 +339,6 @@ namespace detail ////////////////////////////////////////////////////////////// // Operators - template - GLM_FUNC_QUALIFIER tmat4x4& tmat4x4::operator=(tmat4x4 const & m) - { - //memcpy could be faster - //memcpy(&this->value, &m.value, 16 * sizeof(valType)); - this->value[0] = m[0]; - this->value[1] = m[1]; - this->value[2] = m[2]; - this->value[3] = m[3]; - return *this; - } - template template GLM_FUNC_QUALIFIER tmat4x4& tmat4x4::operator=(tmat4x4 const & m) diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index a7a94ed7..68ea98de 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -188,7 +188,11 @@ int test_ctr() { int Error(0); - Error += std::is_copy_constructible::value ? 0 : 1; + //Error += std::is_trivially_default_constructible::value ? 0 : 1; + //Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + //Error += std::is_copy_constructible::value ? 0 : 1; + //Error += std::has_trivial_copy_constructor::value ? 0 : 1; #if(GLM_HAS_INITIALIZER_LISTS) glm::mat4 m0( diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 17813ce7..1ceb7a04 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -47,11 +47,11 @@ int test_vec4_ctor() glm::ivec4 B(A); Error += glm::all(glm::equal(A, B)) ? 0 : 1; - Error += std::is_trivially_default_constructible::value ? 0 : 1; - Error += std::is_trivially_copy_assignable::value ? 0 : 1; +// Error += std::is_trivially_default_constructible::value ? 0 : 1; +// Error += std::is_trivially_copy_assignable::value ? 0 : 1; Error += std::is_trivially_copyable::value ? 0 : 1; - Error += std::is_trivially_copy_assignable::value ? 0 : 1; - Error += std::is_trivially_copyable::value ? 0 : 1; +// Error += std::is_trivially_copy_assignable::value ? 0 : 1; +// Error += std::is_trivially_copyable::value ? 0 : 1; Error += std::has_trivial_copy_constructor::value ? 0 : 1; Error += std::is_copy_constructible::value ? 0 : 1; From f09888a09097092cae454424e257d47c30f5a390 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 12 Nov 2014 21:20:17 +0100 Subject: [PATCH 5/7] Reverse #257, breaking many vec4 types size (i8vec4, u16vec4 etc) --- glm/detail/type_vec4.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/detail/type_vec4.hpp b/glm/detail/type_vec4.hpp index 27cafa33..9dc3e8a8 100644 --- a/glm/detail/type_vec4.hpp +++ b/glm/detail/type_vec4.hpp @@ -67,7 +67,7 @@ namespace detail }//namespace detail template - GLM_ALIGNED_STRUCT(16) tvec4 + struct tvec4 { ////////////////////////////////////// // Implementation detail From debe75a6e1da6168f2fcabf86fac4fa86e9b06fc Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 12 Nov 2014 21:45:12 +0100 Subject: [PATCH 6/7] Added trivially copyable test --- test/core/core_type_mat4x4.cpp | 2 ++ test/core/core_type_vec1.cpp | 12 ++++++++++++ test/core/core_type_vec2.cpp | 12 ++++++++++++ test/core/core_type_vec3.cpp | 16 ++++++++++++++-- test/core/core_type_vec4.cpp | 7 +++++-- 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index 68ea98de..b77efae5 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -188,11 +188,13 @@ int test_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::value ? 0 : 1; //Error += std::is_trivially_copy_assignable::value ? 0 : 1; Error += std::is_trivially_copyable::value ? 0 : 1; //Error += std::is_copy_constructible::value ? 0 : 1; //Error += std::has_trivial_copy_constructor::value ? 0 : 1; +#endif #if(GLM_HAS_INITIALIZER_LISTS) glm::mat4 m0( diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index 6dfc33fc..d32d4be8 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -44,6 +44,18 @@ 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::value ? 0 : 1; +// Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + + Error += std::has_trivial_copy_constructor::value ? 0 : 1; + Error += std::is_copy_constructible::value ? 0 : 1; +#endif + /* #if GLM_HAS_INITIALIZER_LISTS { diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 12a897e4..5a797cb8 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -201,6 +201,18 @@ 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::value ? 0 : 1; +// Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + + Error += std::has_trivial_copy_constructor::value ? 0 : 1; + Error += std::is_copy_constructible::value ? 0 : 1; +#endif + #if GLM_HAS_INITIALIZER_LISTS { glm::vec2 a{ 0, 1 }; diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index f1cc8b91..f2fe3ad2 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -19,8 +19,20 @@ int test_vec3_ctor() { int Error = 0; - -#if(GLM_HAS_INITIALIZER_LISTS) + +#if (GLM_LANG & GLM_LANG_CXX11_FLAG) || (GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC12) +// Error += std::is_trivially_default_constructible::value ? 0 : 1; +// Error += std::is_trivially_copy_assignable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + + Error += std::has_trivial_copy_constructor::value ? 0 : 1; + Error += std::is_copy_constructible::value ? 0 : 1; +#endif + +#if (GLM_HAS_INITIALIZER_LISTS) { glm::vec3 a{ 0, 1, 2 }; std::vector v = { diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 1ceb7a04..e373dbad 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -47,14 +47,17 @@ int test_vec4_ctor() glm::ivec4 B(A); 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::value ? 0 : 1; // Error += std::is_trivially_copy_assignable::value ? 0 : 1; Error += std::is_trivially_copyable::value ? 0 : 1; -// Error += std::is_trivially_copy_assignable::value ? 0 : 1; -// Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; + Error += std::is_trivially_copyable::value ? 0 : 1; Error += std::has_trivial_copy_constructor::value ? 0 : 1; Error += std::is_copy_constructible::value ? 0 : 1; +#endif #if GLM_HAS_INITIALIZER_LISTS { From 062ee19ac763e0f3ed66c6ffb575e6aa3075d12d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 12 Nov 2014 22:48:15 +0100 Subject: [PATCH 7/7] Fixed bitfieldInsert and bitfieldExtract --- glm/detail/func_integer.inl | 2 +- test/core/core_func_common.cpp | 6 +++--- test/core/core_func_integer.cpp | 13 +++++++------ test/gtc/gtc_bitfield.cpp | 20 ++++++++++++-------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index 1c05a09b..d6e94e99 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -44,7 +44,7 @@ namespace detail { GLM_FUNC_QUALIFIER int mask(int Bits) { - return ~((~0) << Bits); + return Bits >= 32 ? 0xffffffff : (static_cast(1) << Bits) - static_cast(1); } }//namespace detail diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index ee75fbf8..61256f30 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -866,7 +866,7 @@ namespace sign { int Error = 0; - std::size_t const Count = 1000000000; + std::size_t const Count = 10000000; std::vector Input, Output; Input.resize(Count); Output.resize(Count); @@ -913,7 +913,7 @@ namespace sign { int Error = 0; - std::size_t const Count = 1000000000; + std::size_t const Count = 10000000; std::vector Input, Output; Input.resize(Count); Output.resize(Count); @@ -960,7 +960,7 @@ namespace sign { int Error = 0; - glm::uint32 const Count = 1000000000; + glm::uint32 const Count = 10000000; std::clock_t Timestamp0 = std::clock(); glm::int32 Sum = 0; diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index 4a75733e..cb07d752 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -37,11 +37,12 @@ namespace bitfieldInsert typeU32 const Data32[] = { + {0x00000000, 0xffffffff, 0, 31, 0x7fffffff}, + {0x00000000, 0xffffffff, 0, 32, 0xffffffff}, + {0x00000000, 0xffffffff, 0, 0, 0x00000000}, {0xff000000, 0x0000ff00, 8, 8, 0xff00ff00}, {0xffff0000, 0x0000ffff, 16, 16, 0x00000000}, - {0x0000ffff, 0xffff0000, 16, 16, 0xffffffff}, - {0x00000000, 0xffffffff, 0, 32, 0xffffffff}, - {0x00000000, 0xffffffff, 0, 0, 0x00000000} + {0x0000ffff, 0xffff0000, 16, 16, 0xffffffff} }; int test() @@ -342,7 +343,7 @@ namespace findMSB std::clock_t Timestamps1 = std::clock(); - for(std::size_t k = 0; k < 10000000; ++k) + for(std::size_t k = 0; k < 1000000; ++k) for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { int Result = findMSB_095(Data[i].Value); @@ -401,7 +402,7 @@ namespace findMSB std::clock_t Timestamps1 = std::clock(); - for(std::size_t k = 0; k < 10000000; ++k) + for(std::size_t k = 0; k < 1000000; ++k) for(std::size_t i = 0; i < sizeof(Data) / sizeof(type); ++i) { int Result = findMSB_nlz1(Data[i].Value); @@ -536,7 +537,7 @@ namespace findMSB int Error(0); Error += perf_950(); - Error += perf_ops(); + //Error += perf_ops(); return Error; } diff --git a/test/gtc/gtc_bitfield.cpp b/test/gtc/gtc_bitfield.cpp index eed75a44..2763e874 100644 --- a/test/gtc/gtc_bitfield.cpp +++ b/test/gtc/gtc_bitfield.cpp @@ -103,10 +103,12 @@ namespace mask { type const Data[] = { - {0, 0x00000000}, - {1, 0x00000001}, - {2, 0x00000003}, - {3, 0x00000007} + { 0, 0x00000000}, + { 1, 0x00000001}, + { 2, 0x00000003}, + { 3, 0x00000007}, + {31, 0x7fffffff}, + {32, 0xffffffff} }; int Error(0); @@ -142,10 +144,12 @@ namespace mask { type const Data[] = { - {glm::ivec4(0), glm::ivec4(0x00000000)}, - {glm::ivec4(1), glm::ivec4(0x00000001)}, - {glm::ivec4(2), glm::ivec4(0x00000003)}, - {glm::ivec4(3), glm::ivec4(0x00000007)} + {glm::ivec4( 0), glm::ivec4(0x00000000)}, + {glm::ivec4( 1), glm::ivec4(0x00000001)}, + {glm::ivec4( 2), glm::ivec4(0x00000003)}, + {glm::ivec4( 3), glm::ivec4(0x00000007)}, + {glm::ivec4(31), glm::ivec4(0x7fffffff)}, + {glm::ivec4(32), glm::ivec4(0xffffffff)} }; int Error(0);