Fix for PoolArray comparison

(cherry picked from commit f26069e94d)
This commit is contained in:
Ninni Pipping 2023-01-09 10:24:08 +01:00 committed by Rémi Verschelde
parent 3a8367ba5e
commit d6360d4c3c
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 27 additions and 27 deletions

View File

@ -2738,28 +2738,28 @@ uint32_t Variant::hash() const {
}
#define hash_compare_scalar(p_lhs, p_rhs) \
((p_lhs) == (p_rhs)) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs))
(((p_lhs) == (p_rhs)) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs)))
#define hash_compare_vector2(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \
(hash_compare_scalar((p_lhs).y, (p_rhs).y))
#define hash_compare_vector2(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x) && \
hash_compare_scalar((p_lhs).y, (p_rhs).y))
#define hash_compare_vector3(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \
(hash_compare_scalar((p_lhs).y, (p_rhs).y)) && \
(hash_compare_scalar((p_lhs).z, (p_rhs).z))
#define hash_compare_vector3(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x) && \
hash_compare_scalar((p_lhs).y, (p_rhs).y) && \
hash_compare_scalar((p_lhs).z, (p_rhs).z))
#define hash_compare_quat(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \
(hash_compare_scalar((p_lhs).y, (p_rhs).y)) && \
(hash_compare_scalar((p_lhs).z, (p_rhs).z)) && \
(hash_compare_scalar((p_lhs).w, (p_rhs).w))
#define hash_compare_quat(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).x, (p_rhs).x) && \
hash_compare_scalar((p_lhs).y, (p_rhs).y) && \
hash_compare_scalar((p_lhs).z, (p_rhs).z) && \
hash_compare_scalar((p_lhs).w, (p_rhs).w))
#define hash_compare_color(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).r, (p_rhs).r)) && \
(hash_compare_scalar((p_lhs).g, (p_rhs).g)) && \
(hash_compare_scalar((p_lhs).b, (p_rhs).b)) && \
(hash_compare_scalar((p_lhs).a, (p_rhs).a))
#define hash_compare_color(p_lhs, p_rhs) \
(hash_compare_scalar((p_lhs).r, (p_rhs).r) && \
hash_compare_scalar((p_lhs).g, (p_rhs).g) && \
hash_compare_scalar((p_lhs).b, (p_rhs).b) && \
hash_compare_scalar((p_lhs).a, (p_rhs).a))
#define hash_compare_pool_array(p_lhs, p_rhs, p_type, p_compare_func) \
const PoolVector<p_type> &l = *reinterpret_cast<const PoolVector<p_type> *>(p_lhs); \
@ -2807,8 +2807,8 @@ bool Variant::hash_compare(const Variant &p_variant) const {
const Rect2 *l = reinterpret_cast<const Rect2 *>(_data._mem);
const Rect2 *r = reinterpret_cast<const Rect2 *>(p_variant._data._mem);
return (hash_compare_vector2(l->position, r->position)) &&
(hash_compare_vector2(l->size, r->size));
return hash_compare_vector2(l->position, r->position) &&
hash_compare_vector2(l->size, r->size);
} break;
case TRANSFORM2D: {
@ -2816,7 +2816,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
Transform2D *r = p_variant._data._transform2d;
for (int i = 0; i < 3; i++) {
if (!(hash_compare_vector2(l->elements[i], r->elements[i]))) {
if (!hash_compare_vector2(l->elements[i], r->elements[i])) {
return false;
}
}
@ -2835,16 +2835,16 @@ bool Variant::hash_compare(const Variant &p_variant) const {
const Plane *l = reinterpret_cast<const Plane *>(_data._mem);
const Plane *r = reinterpret_cast<const Plane *>(p_variant._data._mem);
return (hash_compare_vector3(l->normal, r->normal)) &&
(hash_compare_scalar(l->d, r->d));
return hash_compare_vector3(l->normal, r->normal) &&
hash_compare_scalar(l->d, r->d);
} break;
case AABB: {
const ::AABB *l = _data._aabb;
const ::AABB *r = p_variant._data._aabb;
return (hash_compare_vector3(l->position, r->position) &&
(hash_compare_vector3(l->size, r->size)));
return hash_compare_vector3(l->position, r->position) &&
hash_compare_vector3(l->size, r->size);
} break;
@ -2860,7 +2860,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
const Basis *r = p_variant._data._basis;
for (int i = 0; i < 3; i++) {
if (!(hash_compare_vector3(l->elements[i], r->elements[i]))) {
if (!hash_compare_vector3(l->elements[i], r->elements[i])) {
return false;
}
}
@ -2873,7 +2873,7 @@ bool Variant::hash_compare(const Variant &p_variant) const {
const Transform *r = p_variant._data._transform;
for (int i = 0; i < 3; i++) {
if (!(hash_compare_vector3(l->basis.elements[i], r->basis.elements[i]))) {
if (!hash_compare_vector3(l->basis.elements[i], r->basis.elements[i])) {
return false;
}
}