summaryrefslogtreecommitdiff
path: root/core/variant/variant.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-08 14:26:48 +0200
committerGitHub <noreply@github.com>2021-10-08 14:26:48 +0200
commitcdaa52a8207c66c96bae41c689e0f0235a3e6e79 (patch)
tree916871524416dcfd54113dec348e2cb174806354 /core/variant/variant.cpp
parent5733c13f530e1572bfdf1450630096e180041554 (diff)
parent4a723842b6b8c2f60e0491ab4cb3daae717936fc (diff)
Merge pull request #53555 from Pineapple/faster-int-string-dictionary
Diffstat (limited to 'core/variant/variant.cpp')
-rw-r--r--core/variant/variant.cpp8
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);