Use unary % operator for binary implementation

This commit is contained in:
Christophe Riccio 2016-05-23 21:24:59 +02:00
parent eab004bfe5
commit 5e60c54004

View File

@ -754,61 +754,37 @@ namespace detail
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, T scalar)
{ {
return tvec4<T, P>( return tvec4<T, P>(v) %= scalar;
v.x % scalar,
v.y % scalar,
v.z % scalar,
v.w % scalar);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v, tvec1<T, P> const & scalar) GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec1<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(v1) %= v2.x;
v.x % scalar.x,
v.y % scalar.x,
v.z % scalar.x,
v.w % scalar.x);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(T scalar, tvec4<T, P> const & v) GLM_FUNC_QUALIFIER tvec4<T, P> operator%(T scalar, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(scalar) %= v;
scalar % v.x,
scalar % v.y,
scalar % v.z,
scalar % v.w);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec1<T, P> const & scalar, tvec4<T, P> const & v) GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec1<T, P> const & scalar, tvec4<T, P> const & v)
{ {
return tvec4<T, P>( return tvec4<T, P>(scalar.x) %= v;
scalar.x % v.x,
scalar.x % v.y,
scalar.x % v.z,
scalar.x % v.w);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2) GLM_FUNC_QUALIFIER tvec4<T, P> operator%(tvec4<T, P> const & v1, tvec4<T, P> const & v2)
{ {
return tvec4<T, P>( return tvec4<T, P>(v1) %= v2;
v1.x % v2.x,
v1.y % v2.y,
v1.z % v2.z,
v1.w % v2.w);
} }
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, T scalar) GLM_FUNC_QUALIFIER tvec4<T, P> operator&(tvec4<T, P> const & v, T scalar)
{ {
return tvec4<T, P>( return tvec4<T, P>(v) &= scalar;
v.x & scalar,
v.y & scalar,
v.z & scalar,
v.w & scalar);
} }
template <typename T, precision P> template <typename T, precision P>