You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-04 17:04:49 +00:00
Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`. Improve hashing function for `Color` (based on values instead of `String`). Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used. Remove now unnecessary `HashableHasher`.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "core/error/error_macros.h"
|
||||
#include "core/math/math_funcs.h"
|
||||
#include "core/templates/hashfuncs.h"
|
||||
|
||||
class String;
|
||||
struct Vector2i;
|
||||
@@ -190,6 +191,12 @@ struct [[nodiscard]] Vector2 {
|
||||
explicit operator String() const;
|
||||
operator Vector2i() const;
|
||||
|
||||
uint32_t hash() const {
|
||||
uint32_t h = hash_murmur3_one_real(x);
|
||||
h = hash_murmur3_one_real(y, h);
|
||||
return hash_fmix32(h);
|
||||
}
|
||||
|
||||
// NOLINTBEGIN(cppcoreguidelines-pro-type-member-init)
|
||||
constexpr Vector2() :
|
||||
x(0), y(0) {}
|
||||
|
||||
Reference in New Issue
Block a user