Implementation of == != < <= > >= operators.
This commit is contained in:
parent
ccc831e34d
commit
a561242395
2 changed files with 64 additions and 0 deletions
|
@ -92,6 +92,19 @@ namespace cloonel {
|
|||
template <typename T, typename U, uint32_t S>
|
||||
Vector<typename std::common_type<T, U>::type, S> operator/ ( const Vector<T, S>& parA, U parB ) __attribute__((pure));
|
||||
|
||||
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, typename U, uint32_t S>
|
||||
bool operator> ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure));
|
||||
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, typename U, uint32_t S>
|
||||
bool operator>= ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure));
|
||||
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, typename U, uint32_t S>
|
||||
bool operator!= ( const Vector<T, S>& parA, const Vector<U, S>& parB ) __attribute__((pure));
|
||||
|
||||
typedef Vector<float, 2> float2;
|
||||
typedef Vector<uint16_t, 2> ushort2;
|
||||
typedef Vector<int32_t, 2> int2;
|
||||
|
|
|
@ -187,4 +187,55 @@ namespace cloonel {
|
|||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
///--------------------------------------------------------------------------
|
||||
///--------------------------------------------------------------------------
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator< (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] < parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator> (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] > parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator<= (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] <= parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator>= (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] >= parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator== (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] == parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator!= (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal &= static_cast<bool>(parA[z] != parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
} //namespace cloonel
|
||||
|
|
Loading…
Reference in a new issue