From 50ce473fcf5a6588847b847a25640fa7d3712ad2 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Tue, 15 Jul 2014 17:03:49 +0000 Subject: [PATCH] math: disable some half-float vectors because of VS2013. --- src/lol/math/matrix.h | 6 ++++++ src/lol/math/vector.h | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/lol/math/matrix.h b/src/lol/math/matrix.h index b0d47dbc..74573a58 100644 --- a/src/lol/math/matrix.h +++ b/src/lol/math/matrix.h @@ -130,7 +130,9 @@ static_assert(sizeof(i16mat2) == 8, "sizeof(i16mat2) == 8"); static_assert(sizeof(imat2) == 16, "sizeof(imat2) == 16"); static_assert(sizeof(i64mat2) == 32, "sizeof(i64mat2) == 32"); +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS static_assert(sizeof(f16mat2) == 8, "sizeof(f16mat2) == 8"); +#endif static_assert(sizeof(mat2) == 16, "sizeof(mat2) == 16"); static_assert(sizeof(dmat2) == 32, "sizeof(dmat2) == 32"); @@ -253,7 +255,9 @@ static_assert(sizeof(i16mat3) == 18, "sizeof(i16mat3) == 18"); static_assert(sizeof(imat3) == 36, "sizeof(imat3) == 36"); static_assert(sizeof(i64mat3) == 72, "sizeof(i64mat3) == 72"); +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS static_assert(sizeof(f16mat3) == 18, "sizeof(f16mat3) == 18"); +#endif static_assert(sizeof(mat3) == 36, "sizeof(mat3) == 36"); static_assert(sizeof(dmat3) == 72, "sizeof(dmat3) == 72"); @@ -423,7 +427,9 @@ static_assert(sizeof(i16mat4) == 32, "sizeof(i16mat4) == 32"); static_assert(sizeof(imat4) == 64, "sizeof(imat4) == 64"); static_assert(sizeof(i64mat4) == 128, "sizeof(i64mat4) == 128"); +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS static_assert(sizeof(f16mat4) == 32, "sizeof(f16mat4) == 32"); +#endif static_assert(sizeof(mat4) == 64, "sizeof(mat4) == 64"); static_assert(sizeof(dmat4) == 128, "sizeof(dmat4) == 128"); diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index c37802ae..6fcce81a 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -65,11 +65,11 @@ struct vec_t /* Disable all default constructors and destructors; this object * is only intended to exist as part of a union. */ +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS vec_t() = delete; vec_t(vec_t const &) = delete; ~vec_t() = delete; -#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS /* Allow the assignment operator if unrestricted unions are supported. */ inline vec_t& operator =(vec_t that); { @@ -83,8 +83,6 @@ struct vec_t /* Pass by value in case this == &that */ return *this = (vec_t)that; } -#else - vec_t& operator =(vec_t that) = delete; #endif inline T& operator[](size_t n) @@ -275,7 +273,9 @@ static_assert(sizeof(i16vec2) == 4, "sizeof(i16vec2) == 4"); static_assert(sizeof(ivec2) == 8, "sizeof(ivec2) == 8"); static_assert(sizeof(i64vec2) == 16, "sizeof(i64vec2) == 16"); +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS static_assert(sizeof(f16vec2) == 4, "sizeof(f16vec2) == 4"); +#endif static_assert(sizeof(vec2) == 8, "sizeof(vec2) == 8"); static_assert(sizeof(dvec2) == 16, "sizeof(dvec2) == 16"); @@ -512,7 +512,9 @@ static_assert(sizeof(i16vec3) == 6, "sizeof(i16vec3) == 6"); static_assert(sizeof(ivec3) == 12, "sizeof(ivec3) == 12"); static_assert(sizeof(i64vec3) == 24, "sizeof(i64vec3) == 24"); +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS static_assert(sizeof(f16vec3) == 6, "sizeof(f16vec3) == 6"); +#endif static_assert(sizeof(vec3) == 12, "sizeof(vec3) == 12"); static_assert(sizeof(dvec3) == 24, "sizeof(dvec3) == 24"); @@ -942,7 +944,9 @@ static_assert(sizeof(i16vec4) == 8, "sizeof(i16vec4) == 8"); static_assert(sizeof(ivec4) == 16, "sizeof(ivec4) == 16"); static_assert(sizeof(i64vec4) == 32, "sizeof(i64vec4) == 32"); +#if LOL_FEATURE_CXX11_UNRESTRICTED_UNIONS static_assert(sizeof(f16vec4) == 8, "sizeof(f16vec4) == 8"); +#endif static_assert(sizeof(vec4) == 16, "sizeof(vec4) == 16"); static_assert(sizeof(dvec4) == 32, "sizeof(dvec4) == 32"); @@ -951,7 +955,8 @@ static_assert(sizeof(dvec4) == 32, "sizeof(dvec4) == 32"); */ template -static inline vec_t operator *(T const &val, vec_t const &a) +static inline typename std::enable_if>::type +operator *(T const &val, vec_t const &a) { vec_t ret; for (int i = 0; i < N; ++i) @@ -1178,14 +1183,14 @@ public: } template - inline typename std::enable_if::type + inline typename std::enable_if::type operator *() const { return m_vec[m_pos]; } template - inline typename std::enable_if::type + inline typename std::enable_if::type operator *() const { return m_vec[m_pos];