diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-10-08 14:26:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-08 14:26:48 +0200 |
commit | cdaa52a8207c66c96bae41c689e0f0235a3e6e79 (patch) | |
tree | 916871524416dcfd54113dec348e2cb174806354 /core/variant/variant.cpp | |
parent | 5733c13f530e1572bfdf1450630096e180041554 (diff) | |
parent | 4a723842b6b8c2f60e0491ab4cb3daae717936fc (diff) |
Merge pull request #53555 from Pineapple/faster-int-string-dictionary
Diffstat (limited to 'core/variant/variant.cpp')
-rw-r--r-- | core/variant/variant.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/variant/variant.cpp b/core/variant/variant.cpp index 0dbeb6e4cb..86d772fb07 100644 --- a/core/variant/variant.cpp +++ b/core/variant/variant.cpp @@ -3145,10 +3145,18 @@ bool Variant::hash_compare(const Variant &p_variant) const { } switch (type) { + case INT: { + return _data._int == p_variant._data._int; + } break; + case FLOAT: { return hash_compare_scalar(_data._float, p_variant._data._float); } break; + case STRING: { + return *reinterpret_cast<const String *>(_data._mem) == *reinterpret_cast<const String *>(p_variant._data._mem); + } break; + case VECTOR2: { const Vector2 *l = reinterpret_cast<const Vector2 *>(_data._mem); const Vector2 *r = reinterpret_cast<const Vector2 *>(p_variant._data._mem); |