diff options
author | Arman Elgudzhyan <48544263+puchik@users.noreply.github.com> | 2023-03-07 19:13:00 -0800 |
---|---|---|
committer | Arman Elgudzhyan <48544263+puchik@users.noreply.github.com> | 2023-08-31 09:29:48 -0700 |
commit | ee272546020ffdbc0ab565c14d047a329d4c1ea2 (patch) | |
tree | b299237a045322c7fcd34964b51b95c3242e7e73 /core/variant/variant.h | |
parent | 549fcce5f8f7beace3e5c90e9bbe4335d4fd1476 (diff) | |
download | redot-engine-ee272546020ffdbc0ab565c14d047a329d4c1ea2.tar.gz |
Support both semantic (by default) and numeric Variant hash comparison
Hash comparison for Variant continues to perform semantic/logical comparison with NaN's considered equal by default (to prevent #16114, #7354, #6947, #8081), but now optionally allows for numeric comparison that does not consider NaN's equal to support proper value comparison (for #72222)
Diffstat (limited to 'core/variant/variant.h')
-rw-r--r-- | core/variant/variant.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/variant/variant.h b/core/variant/variant.h index 04c2fe2012..d698f85754 100644 --- a/core/variant/variant.h +++ b/core/variant/variant.h @@ -751,7 +751,8 @@ public: uint32_t hash() const; uint32_t recursive_hash(int recursion_count) const; - bool hash_compare(const Variant &p_variant, int recursion_count = 0) const; + // By default, performs a semantic comparison. Otherwise, numeric/binary comparison (if appropriate). + bool hash_compare(const Variant &p_variant, int recursion_count = 0, bool semantic_comparison = true) const; bool identity_compare(const Variant &p_variant) const; bool booleanize() const; String stringify(int recursion_count = 0) const; |