Fix vector comparison and add unit test.
This commit is contained in:
parent
6aa4d15381
commit
971cd54688
3 changed files with 39 additions and 14 deletions
|
@ -199,35 +199,27 @@ namespace cloonel {
|
|||
///--------------------------------------------------------------------------
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator< (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = false;
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal |= static_cast<bool>(parA[z] < parB[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 = false;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal |= static_cast<bool>(parA[z] > parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
return not (parA <= parB);
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator<= (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
bool retVal = false;
|
||||
bool retVal = true;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal |= static_cast<bool>(parA[z] <= parB[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 = false;
|
||||
for (uint32_t z = 0; z < S; ++z) {
|
||||
retVal |= static_cast<bool>(parA[z] >= parB[z]);
|
||||
}
|
||||
return retVal;
|
||||
return not (parA < parB);
|
||||
}
|
||||
template <typename T, typename U, uint32_t S>
|
||||
inline bool operator== (const Vector<T, S>& parA, const Vector<U, S>& parB) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue