Support for unary minus operator.

This commit is contained in:
King_DuckZ 2014-03-23 22:07:01 +01:00
parent 4cabdef306
commit 108c10883a
2 changed files with 11 additions and 0 deletions

View file

@ -105,6 +105,9 @@ namespace cloonel {
template <typename T, typename U, uint32_t S>
bool operator!= ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure));
template <typename T, uint32_t S>
Vector<T, S> operator- ( Vector<T, S> parOperand ) __attribute__((pure));
typedef Vector<float, 2> float2;
typedef Vector<uint16_t, 2> ushort2;
typedef Vector<int32_t, 2> int2;

View file

@ -245,4 +245,12 @@ namespace cloonel {
}
return retVal;
}
template <typename T, uint32_t S>
Vector<T, S> operator- (Vector<T, S> parOperand) {
for (uint32_t z = 0; z < S; ++z) {
parOperand[z] = -parOperand[z];
}
return parOperand;
}
} //namespace cloonel