Sync a few templates with upstream Godot - #2039
Conversation
Ivorforce
left a comment
There was a problem hiding this comment.
Looks mostly good! Just the hashfuncs change is problematic.
| static _FORCE_INLINE_ uint32_t hash(const wchar_t p_wchar) { return hash_fmix32(uint32_t(p_wchar)); } | ||
| static _FORCE_INLINE_ uint32_t hash(const char16_t p_uchar) { return hash_fmix32(uint32_t(p_uchar)); } | ||
| static _FORCE_INLINE_ uint32_t hash(const char32_t p_uchar) { return hash_fmix32(uint32_t(p_uchar)); } | ||
| static _FORCE_INLINE_ uint32_t hash(const RID &p_rid) { return hash_one_uint64(p_rid.get_id()); } | ||
| static _FORCE_INLINE_ uint32_t hash(const CharString &p_char_string) { return hash_djb2(p_char_string.get_data()); } | ||
| static _FORCE_INLINE_ uint32_t hash(const StringName &p_string_name) { return p_string_name.hash(); } | ||
| static _FORCE_INLINE_ uint32_t hash(const NodePath &p_path) { return p_path.hash(); } | ||
| static _FORCE_INLINE_ uint32_t hash(const ObjectID &p_id) { return hash_one_uint64(p_id); } | ||
| static _FORCE_INLINE_ uint32_t hash(const Callable &p_callable) { return p_callable.hash(); } |
There was a problem hiding this comment.
You can't remove all these methods from the file (above and below too) without also declaring hash() on the respective types. That's the new contract of HashMapHasherDefault.
Your options are to either not sync this part of the hashfuncs yet (which I'd recommend) or to patch every single type that holds hash() in upstream.
There was a problem hiding this comment.
Right, missed that oops. I removed the HashMapHasherDefaultImpl struct now. There is some code that was only used for this struct, e.g. has_hash_method_v. I thought I'd still leave them in to deviate as little from upstream as possible but if you prefer I remove everything related to HashMapHasherDefaultImpl I can do that, just lmk
There was a problem hiding this comment.
Oh, and HashMapComparatorDefault also has lots of methods removed but as far as I can tell this one's fine... but would be good if you confirm.
cad4737 to
75d2033
Compare
This syncs a few classes in the templates folder with godot upstream. Done by copy-pasting the code from upstream, then resolving the diffs. It looks like
hashfuncs.cppis the first.cppfile for templates, so had to also edit thegodotcpp.pytool to include it in compilation. Also renamedsort_list.htosort_list.hppto match the other files. I will likely do a bunch more since there are more left but I thought I'd open a PR now since it is already a considerable number of changes.