vector comparison fix 2
This commit is contained in:
parent
29ea2927e3
commit
c8656a351b
2 changed files with 12 additions and 8 deletions
|
|
@ -292,19 +292,20 @@ namespace Crafter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename BT>
|
template <typename BT, std::uint32_t Blen, std::uint32_t BAlignment>
|
||||||
constexpr bool operator==(BT b) const {
|
constexpr bool operator==(Vector<BT, Blen, BAlignment> b) const {
|
||||||
for(std::uint32_t i = 0; i < Len; i++) {
|
for(std::uint32_t i = 0; i < std::min(Len, Blen); i++) {
|
||||||
if(this->v[i] != b->v[i]) {
|
if(this->v[i] != b.v[i]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
template <typename BT>
|
|
||||||
constexpr bool operator!=(BT b) const {
|
template <typename BT, std::uint32_t Blen, std::uint32_t BAlignment>
|
||||||
for(std::uint32_t i = 0; i < Len; i++) {
|
constexpr bool operator!=(Vector<BT, Blen, BAlignment> b) const {
|
||||||
if(this->v[i] != b->v[i]) {
|
for(std::uint32_t i = 0; i < std::min(Len, Blen); i++) {
|
||||||
|
if(this->v[i] != b.v[i]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,7 @@ int main() {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// return 0;
|
// return 0;
|
||||||
|
|
||||||
|
|
||||||
|
std::cout << (Vector<float, 3, 0>(5, 0, 0) == Vector<float, 3, 0>(5,0,1)) << std::endl;
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue