Improved constexpr coverrage

This commit is contained in:
Groove 2018-07-29 12:04:18 +02:00
parent 8892c7da59
commit d0472e0676
3 changed files with 184 additions and 92 deletions

View File

@ -216,142 +216,142 @@ namespace glm
GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator+(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator-(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator-(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator*(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator*(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator*(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator/(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator/(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator/(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator%(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator%(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator%(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator&(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator&(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator&(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator|(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator|(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator|(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator^(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator^(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator^(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator<<(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<2, T, Q> const& v, T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v, T scalar);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator>>(T scalar, vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q> const& v);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2);
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_DECL vec<2, T, Q> operator~(vec<2, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q> const& v);
// -- Boolean operators -- // -- Boolean operators --

View File

@ -501,7 +501,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator-(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x - scalar, v.x - scalar,
@ -509,7 +509,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x - v2.x, v1.x - v2.x,
@ -517,7 +517,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator-(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator-(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar - v.x, scalar - v.x,
@ -525,7 +525,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator-(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator-(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x - v2.x, v1.x - v2.x,
@ -533,7 +533,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator-(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x - v2.x, v1.x - v2.x,
@ -541,7 +541,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator*(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x * scalar, v.x * scalar,
@ -549,7 +549,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x * v2.x, v1.x * v2.x,
@ -557,7 +557,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator*(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator*(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar * v.x, scalar * v.x,
@ -565,7 +565,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator*(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator*(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x * v2.x, v1.x * v2.x,
@ -573,7 +573,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator*(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x * v2.x, v1.x * v2.x,
@ -581,7 +581,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator/(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x / scalar, v.x / scalar,
@ -589,7 +589,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x / v2.x, v1.x / v2.x,
@ -597,7 +597,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator/(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator/(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar / v.x, scalar / v.x,
@ -605,7 +605,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator/(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator/(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x / v2.x, v1.x / v2.x,
@ -613,7 +613,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator/(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x / v2.x, v1.x / v2.x,
@ -623,7 +623,7 @@ namespace glm
// -- Binary bit operators -- // -- Binary bit operators --
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator%(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x % scalar, v.x % scalar,
@ -631,7 +631,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x % v2.x, v1.x % v2.x,
@ -639,7 +639,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator%(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator%(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar % v.x, scalar % v.x,
@ -647,7 +647,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator%(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator%(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x % v2.x, v1.x % v2.x,
@ -655,7 +655,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator%(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x % v2.x, v1.x % v2.x,
@ -663,7 +663,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator&(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x & scalar, v.x & scalar,
@ -671,7 +671,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x & v2.x, v1.x & v2.x,
@ -679,7 +679,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator&(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator&(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar & v.x, scalar & v.x,
@ -687,7 +687,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator&(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator&(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x & v2.x, v1.x & v2.x,
@ -695,7 +695,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator&(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x & v2.x, v1.x & v2.x,
@ -703,7 +703,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator|(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x | scalar, v.x | scalar,
@ -711,7 +711,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x | v2.x, v1.x | v2.x,
@ -719,7 +719,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator|(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator|(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar | v.x, scalar | v.x,
@ -727,7 +727,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator|(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator|(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x | v2.x, v1.x | v2.x,
@ -735,7 +735,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator|(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x | v2.x, v1.x | v2.x,
@ -743,7 +743,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator^(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x ^ scalar, v.x ^ scalar,
@ -751,7 +751,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x ^ v2.x, v1.x ^ v2.x,
@ -759,7 +759,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator^(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator^(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar ^ v.x, scalar ^ v.x,
@ -767,7 +767,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator^(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator^(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x ^ v2.x, v1.x ^ v2.x,
@ -775,7 +775,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator^(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x ^ v2.x, v1.x ^ v2.x,
@ -783,7 +783,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator<<(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x << scalar, v.x << scalar,
@ -791,7 +791,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x << v2.x, v1.x << v2.x,
@ -799,7 +799,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator<<(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator<<(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar << v.x, scalar << v.x,
@ -807,7 +807,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator<<(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x << v2.x, v1.x << v2.x,
@ -815,7 +815,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator<<(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x << v2.x, v1.x << v2.x,
@ -823,7 +823,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator>>(vec<2, T, Q> const& v, T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v, T scalar)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v.x >> scalar, v.x >> scalar,
@ -831,7 +831,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<1, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x >> v2.x, v1.x >> v2.x,
@ -839,7 +839,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator>>(T scalar, vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator>>(T scalar, vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
scalar >> v.x, scalar >> v.x,
@ -847,7 +847,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator>>(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<1, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x >> v2.x, v1.x >> v2.x,
@ -855,7 +855,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator>>(vec<2, T, Q> const& v1, vec<2, T, Q> const& v2)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
v1.x >> v2.x, v1.x >> v2.x,
@ -863,7 +863,7 @@ namespace glm
} }
template<typename T, qualifier Q> template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<2, T, Q> operator~(vec<2, T, Q> const& v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<2, T, Q> operator~(vec<2, T, Q> const& v)
{ {
return vec<2, T, Q>( return vec<2, T, Q>(
~v.x, ~v.x,

View File

@ -109,6 +109,98 @@ static int test_vec2()
constexpr glm::ivec2 B = A + 1; constexpr glm::ivec2 B = A + 1;
constexpr glm::ivec2 C(3); constexpr glm::ivec2 C(3);
static_assert(A + B == C, "GLM: Failed constexpr"); static_assert(A + B == C, "GLM: Failed constexpr");
constexpr glm::ivec2 D = +A;
static_assert(D == A, "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(3);
constexpr glm::ivec2 B = A - 1;
constexpr glm::ivec2 C(1);
static_assert(A - B == C, "GLM: Failed constexpr");
constexpr glm::ivec2 D = -A;
static_assert(-D == A, "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(3);
constexpr glm::ivec2 B = A * 1;
static_assert(A == B, "GLM: Failed constexpr");
constexpr glm::ivec2 C(1);
static_assert(B * C == A, "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(3);
constexpr glm::ivec2 B = A / 1;
static_assert(A == B, "GLM: Failed constexpr");
constexpr glm::ivec2 C(1);
static_assert(B / C == A, "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(3);
constexpr glm::ivec2 B = A % 2;
constexpr glm::ivec2 C(1);
static_assert(B == C, "GLM: Failed constexpr");
constexpr glm::ivec1 D(2);
static_assert(A % D == C, "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(1);
constexpr glm::ivec2 B = A & 1;
static_assert(A == B, "GLM: Failed constexpr");
constexpr glm::ivec1 C(1);
static_assert(A == (A & C), "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(1);
constexpr glm::ivec2 B = A | 1;
static_assert(A == B, "GLM: Failed constexpr");
constexpr glm::ivec1 C(1);
static_assert(A == (A | C), "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(1);
constexpr glm::ivec2 B = A ^ 0;
static_assert(A == B, "GLM: Failed constexpr");
constexpr glm::ivec1 C(0);
static_assert(A == (A ^ C), "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(1);
constexpr glm::ivec2 B = A << 1;
static_assert(B == glm::ivec2(2), "GLM: Failed constexpr");
constexpr glm::ivec1 C(1);
static_assert(B == (A << C), "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(2);
constexpr glm::ivec2 B = A >> 1;
static_assert(B == glm::ivec2(1), "GLM: Failed constexpr");
constexpr glm::ivec1 C(1);
static_assert(B == A >> C, "GLM: Failed constexpr");
}
{
constexpr glm::ivec2 A(~0);
constexpr glm::ivec2 B = ~A;
static_assert(A == ~B, "GLM: Failed constexpr");
} }
return Error; return Error;