diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-06-20 14:01:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 14:01:06 +0200 |
commit | 66a30dab35f3788ae28c7e6171d3908fe75e7b75 (patch) | |
tree | cc5045d98995b754097d1dde100f0138033fc735 /core/io | |
parent | 8e3d9a23aa0a724d3dd25fcf0e8085b5a438c233 (diff) | |
parent | 141c3755814cea60888c7ee548c7ce709550b784 (diff) |
Merge pull request #62176 from reduz/cleanup-hashfuncs
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/file_access_pack.h | 4 | ||||
-rw-r--r-- | core/io/resource.cpp | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 19a0cce796..e656f6b885 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -84,8 +84,8 @@ private: return (a == p_val.a) && (b == p_val.b); } static uint32_t hash(const PathMD5 &p_val) { - uint32_t h = hash_djb2_one_32(p_val.a); - return hash_djb2_one_32(p_val.b, h); + uint32_t h = hash_murmur3_one_32(p_val.a); + return hash_fmix32(hash_murmur3_one_32(p_val.b, h)); } PathMD5() {} diff --git a/core/io/resource.cpp b/core/io/resource.cpp index ad01eb1083..ed7228d0b9 100644 --- a/core/io/resource.cpp +++ b/core/io/resource.cpp @@ -100,14 +100,14 @@ String Resource::generate_scene_unique_id() { // If it's not unique it does not matter because the saver will try again. OS::Date date = OS::get_singleton()->get_date(); OS::Time time = OS::get_singleton()->get_time(); - uint32_t hash = hash_djb2_one_32(OS::get_singleton()->get_ticks_usec()); - hash = hash_djb2_one_32(date.year, hash); - hash = hash_djb2_one_32(date.month, hash); - hash = hash_djb2_one_32(date.day, hash); - hash = hash_djb2_one_32(time.hour, hash); - hash = hash_djb2_one_32(time.minute, hash); - hash = hash_djb2_one_32(time.second, hash); - hash = hash_djb2_one_32(Math::rand(), hash); + uint32_t hash = hash_murmur3_one_32(OS::get_singleton()->get_ticks_usec()); + hash = hash_murmur3_one_32(date.year, hash); + hash = hash_murmur3_one_32(date.month, hash); + hash = hash_murmur3_one_32(date.day, hash); + hash = hash_murmur3_one_32(time.hour, hash); + hash = hash_murmur3_one_32(time.minute, hash); + hash = hash_murmur3_one_32(time.second, hash); + hash = hash_murmur3_one_32(Math::rand(), hash); static constexpr uint32_t characters = 5; static constexpr uint32_t char_count = ('z' - 'a'); @@ -328,7 +328,7 @@ void Resource::notify_change_to_owners() { #ifdef TOOLS_ENABLED uint32_t Resource::hash_edited_version() const { - uint32_t hash = hash_djb2_one_32(get_edited_version()); + uint32_t hash = hash_murmur3_one_32(get_edited_version()); List<PropertyInfo> plist; get_property_list(&plist); @@ -337,7 +337,7 @@ uint32_t Resource::hash_edited_version() const { if (E.usage & PROPERTY_USAGE_STORAGE && E.type == Variant::OBJECT && E.hint == PROPERTY_HINT_RESOURCE_TYPE) { Ref<Resource> res = get(E.name); if (res.is_valid()) { - hash = hash_djb2_one_32(res->hash_edited_version(), hash); + hash = hash_murmur3_one_32(res->hash_edited_version(), hash); } } } |