Skip to content

Commit

Permalink
[Core] Add missing HashMapComparatorDefault<Vector4>
Browse files Browse the repository at this point in the history
Ensures this handles `NaN` correctly
  • Loading branch information
AThousandShips committed Sep 27, 2024
1 parent 76a1359 commit defca18
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/templates/hashfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,13 @@ struct HashMapComparatorDefault<Vector3> {
}
};

template <>
struct HashMapComparatorDefault<Vector4> {
static bool compare(const Vector4 &p_lhs, const Vector4 &p_rhs) {
return ((p_lhs.x == p_rhs.x) || (Math::is_nan(p_lhs.x) && Math::is_nan(p_rhs.x))) && ((p_lhs.y == p_rhs.y) || (Math::is_nan(p_lhs.y) && Math::is_nan(p_rhs.y))) && ((p_lhs.z == p_rhs.z) || (Math::is_nan(p_lhs.z) && Math::is_nan(p_rhs.z))) && ((p_lhs.w == p_rhs.w) || (Math::is_nan(p_lhs.w) && Math::is_nan(p_rhs.w)));
}
};

constexpr uint32_t HASH_TABLE_SIZE_MAX = 29;

inline constexpr uint32_t hash_table_size_primes[HASH_TABLE_SIZE_MAX] = {
Expand Down

0 comments on commit defca18

Please sign in to comment.