diff --git a/core/variant/dictionary.cpp b/core/variant/dictionary.cpp index 7945452620a..c0d5be5a4fe 100644 --- a/core/variant/dictionary.cpp +++ b/core/variant/dictionary.cpp @@ -47,7 +47,7 @@ STATIC_ASSERT_INCOMPLETE_TYPE(class, String); struct DictionaryPrivate { SafeRefCount refcount; Variant *read_only = nullptr; // If enabled, a pointer is used to a temporary value that is used to return read-only values. - HashMap variant_map; + HashMap variant_map; ContainerTypeValidate typed_key; ContainerTypeValidate typed_value; Variant *typed_fallback = nullptr; // Allows a typed dictionary to return dummy values when attempting an invalid access. @@ -143,7 +143,7 @@ const Variant *Dictionary::getptr(const Variant &p_key) const { if (unlikely(!_p->typed_key.validate(key, "getptr"))) { return nullptr; } - HashMap::ConstIterator E(_p->variant_map.find(key)); + HashMap::ConstIterator E(_p->variant_map.find(key)); if (!E) { return nullptr; } @@ -156,7 +156,7 @@ Variant *Dictionary::getptr(const Variant &p_key) { if (unlikely(!_p->typed_key.validate(key, "getptr"))) { return nullptr; } - HashMap::Iterator E(_p->variant_map.find(key)); + HashMap::Iterator E(_p->variant_map.find(key)); if (!E) { return nullptr; } @@ -171,7 +171,7 @@ Variant *Dictionary::getptr(const Variant &p_key) { Variant Dictionary::get_valid(const Variant &p_key) const { Variant key = p_key; ERR_FAIL_COND_V(!_p->typed_key.validate(key, "get_valid"), Variant()); - HashMap::ConstIterator E(_p->variant_map.find(key)); + HashMap::ConstIterator E(_p->variant_map.find(key)); if (!E) { return Variant(); @@ -280,7 +280,7 @@ bool Dictionary::recursive_equal(const Dictionary &p_dictionary, int recursion_c } recursion_count++; for (const KeyValue &this_E : _p->variant_map) { - HashMap::ConstIterator other_E(p_dictionary._p->variant_map.find(this_E.key)); + HashMap::ConstIterator other_E(p_dictionary._p->variant_map.find(this_E.key)); if (!other_E || !this_E.value.hash_compare(other_E->value, recursion_count, false)) { return false; } @@ -438,7 +438,7 @@ void Dictionary::assign(const Dictionary &p_dictionary) { } int size = p_dictionary._p->variant_map.size(); - HashMap variant_map = HashMap(size); + HashMap variant_map = HashMap(size); Vector key_array; key_array.resize(size); @@ -571,7 +571,7 @@ const Variant *Dictionary::next(const Variant *p_key) const { } Variant key = *p_key; ERR_FAIL_COND_V(!_p->typed_key.validate(key, "next"), nullptr); - HashMap::Iterator E = _p->variant_map.find(key); + HashMap::Iterator E = _p->variant_map.find(key); if (!E) { return nullptr; diff --git a/core/variant/dictionary.h b/core/variant/dictionary.h index 34c870a8e54..01f8bd894d9 100644 --- a/core/variant/dictionary.h +++ b/core/variant/dictionary.h @@ -42,7 +42,6 @@ struct ContainerType; struct ContainerTypeValidate; struct DictionaryPrivate; struct StringLikeVariantComparator; -struct VariantHasher; class Dictionary { mutable DictionaryPrivate *_p; @@ -51,7 +50,7 @@ class Dictionary { void _unref() const; public: - using ConstIterator = HashMap::ConstIterator; + using ConstIterator = HashMap::ConstIterator; ConstIterator begin() const; ConstIterator end() const; diff --git a/core/variant/variant.h b/core/variant/variant.h index a9bf179d225..5b2e7a9631a 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -884,12 +884,9 @@ Vector varray(VarArgs... p_args) { return Vector{ p_args... }; } -struct VariantHasher { - static _FORCE_INLINE_ uint32_t hash(const Variant &p_variant) { return p_variant.hash(); } -}; - -struct VariantComparator { - static _FORCE_INLINE_ bool compare(const Variant &p_lhs, const Variant &p_rhs) { return p_lhs.hash_compare(p_rhs); } +template <> +struct HashMapComparatorDefault { + static bool compare(const Variant &p_lhs, const Variant &p_rhs) { return p_lhs.hash_compare(p_rhs); } }; struct StringLikeVariantComparator { diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h index 6eee0debd58..da3ee688fc3 100644 --- a/modules/csg/csg_shape.h +++ b/modules/csg/csg_shape.h @@ -82,15 +82,6 @@ private: Ref root_mesh; - struct Vector3Hasher { - _ALWAYS_INLINE_ uint32_t hash(const Vector3 &p_vec3) const { - uint32_t h = hash_murmur3_one_float(p_vec3.x); - h = hash_murmur3_one_float(p_vec3.y, h); - h = hash_murmur3_one_float(p_vec3.z, h); - return h; - } - }; - struct ShapeUpdateSurface { Vector vertices; Vector normals; diff --git a/modules/gdscript/gdscript_analyzer.cpp b/modules/gdscript/gdscript_analyzer.cpp index 916283a2ddb..3b7a994771a 100644 --- a/modules/gdscript/gdscript_analyzer.cpp +++ b/modules/gdscript/gdscript_analyzer.cpp @@ -3833,7 +3833,7 @@ void GDScriptAnalyzer::reduce_cast(GDScriptParser::CastNode *p_cast) { } void GDScriptAnalyzer::reduce_dictionary(GDScriptParser::DictionaryNode *p_dictionary) { - HashMap elements; + HashMap elements; for (int i = 0; i < p_dictionary->elements.size(); i++) { const GDScriptParser::DictionaryNode::Pair &element = p_dictionary->elements[i]; diff --git a/modules/gdscript/gdscript_byte_codegen.h b/modules/gdscript/gdscript_byte_codegen.h index 11456683b9e..c2aac171400 100644 --- a/modules/gdscript/gdscript_byte_codegen.h +++ b/modules/gdscript/gdscript_byte_codegen.h @@ -104,7 +104,7 @@ class GDScriptByteCodeGenerator : public GDScriptCodeGenerator { List temp_stack; #endif - HashMap constant_map; + HashMap constant_map; RBMap name_map; #ifdef TOOLS_ENABLED Vector named_globals; diff --git a/modules/gdscript/gdscript_tokenizer_buffer.cpp b/modules/gdscript/gdscript_tokenizer_buffer.cpp index 80186e4c715..37d2638083f 100644 --- a/modules/gdscript/gdscript_tokenizer_buffer.cpp +++ b/modules/gdscript/gdscript_tokenizer_buffer.cpp @@ -33,7 +33,7 @@ #include "core/io/compression.h" #include "core/io/marshalls.h" -int GDScriptTokenizerBuffer::_token_to_binary(const Token &p_token, Vector &r_buffer, int p_start, HashMap &r_identifiers_map, HashMap &r_constants_map) { +int GDScriptTokenizerBuffer::_token_to_binary(const Token &p_token, Vector &r_buffer, int p_start, HashMap &r_identifiers_map, HashMap &r_constants_map) { int pos = p_start; int token_type = p_token.type & TOKEN_MASK; @@ -239,7 +239,7 @@ Error GDScriptTokenizerBuffer::set_code_buffer(const Vector &p_buffer) Vector GDScriptTokenizerBuffer::parse_code_string(const String &p_code, CompressMode p_compress_mode) { HashMap identifier_map; - HashMap constant_map; + HashMap constant_map; Vector token_buffer; HashMap token_lines; HashMap token_columns; diff --git a/modules/gdscript/gdscript_tokenizer_buffer.h b/modules/gdscript/gdscript_tokenizer_buffer.h index 74de533801f..4c2a9f3b263 100644 --- a/modules/gdscript/gdscript_tokenizer_buffer.h +++ b/modules/gdscript/gdscript_tokenizer_buffer.h @@ -63,7 +63,7 @@ public: HashMap dummy; #endif // TOOLS_ENABLED - static int _token_to_binary(const Token &p_token, Vector &r_buffer, int p_start, HashMap &r_identifiers_map, HashMap &r_constants_map); + static int _token_to_binary(const Token &p_token, Vector &r_buffer, int p_start, HashMap &r_identifiers_map, HashMap &r_constants_map); Token _binary_to_token(const uint8_t *p_buffer); public: diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index ab97a3a3f40..53afde34a59 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -535,7 +535,7 @@ class TextServerAdvanced : public TextServerExtension { Rect2 rect; double baseline = 0; }; - HashMap objects; + HashMap objects; /* Shaped data */ TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. diff --git a/modules/text_server_fb/text_server_fb.h b/modules/text_server_fb/text_server_fb.h index 8349f37c187..99cb2ed7951 100644 --- a/modules/text_server_fb/text_server_fb.h +++ b/modules/text_server_fb/text_server_fb.h @@ -458,7 +458,7 @@ class TextServerFallback : public TextServerExtension { Rect2 rect; double baseline = 0; }; - HashMap objects; + HashMap objects; /* Shaped data */ TextServer::Direction para_direction = DIRECTION_LTR; // Detected text direction. diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index dafa350b271..eb12d28b676 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -775,7 +775,7 @@ static int _nm_get_string(const String &p_string, HashMap &name return idx; } -static int _vm_get_variant(const Variant &p_variant, HashMap &variant_map) { +static int _vm_get_variant(const Variant &p_variant, HashMap &variant_map) { if (variant_map.has(p_variant)) { return variant_map[p_variant]; } @@ -785,7 +785,7 @@ static int _vm_get_variant(const Variant &p_variant, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map, HashSet &ids_saved) { +Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map, HashSet &ids_saved) { // this function handles all the work related to properly packing scenes, be it // instantiated or inherited. // given the complexity of this process, an attempt will be made to properly @@ -1133,7 +1133,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Has return OK; } -Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map) { +Error SceneState::_parse_connections(Node *p_owner, Node *p_node, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map) { // Ignore nodes that are within a scene instance. if (p_node != p_owner && p_node->get_owner() && p_node->get_owner() != p_owner && !p_owner->is_editable_instance(p_node->get_owner())) { return OK; @@ -1347,7 +1347,7 @@ Error SceneState::pack(Node *p_scene) { Node *scene = p_scene; HashMap name_map; - HashMap variant_map; + HashMap variant_map; HashMap node_map; HashMap nodepath_map; HashSet ids_saved; diff --git a/scene/resources/packed_scene.h b/scene/resources/packed_scene.h index 59af4721cdb..9b397231552 100644 --- a/scene/resources/packed_scene.h +++ b/scene/resources/packed_scene.h @@ -90,8 +90,8 @@ class SceneState : public RefCounted { Vector connections; - Error _parse_node(Node *p_owner, Node *p_node, int p_parent_idx, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map, HashSet &ids_saved); - Error _parse_connections(Node *p_owner, Node *p_node, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map); + Error _parse_node(Node *p_owner, Node *p_node, int p_parent_idx, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map, HashSet &ids_saved); + Error _parse_connections(Node *p_owner, Node *p_node, HashMap &name_map, HashMap &variant_map, HashMap &node_map, HashMap &nodepath_map); String path;