Merge pull request #53555 from Pineapple/faster-int-string-dictionary

This commit is contained in:
Rémi Verschelde 2021-10-08 14:26:48 +02:00 committed by GitHub
commit cdaa52a820
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);