Merge pull request #52535 from e8newallm/52490-type_conversion

Added explicit type conversion to uint32_t
This commit is contained in:
Rémi Verschelde 2021-09-14 15:36:52 +02:00 committed by GitHub
commit 1cec7057bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2832,7 +2832,7 @@ uint32_t Variant::hash() const {
return _data._bool ? 1 : 0; return _data._bool ? 1 : 0;
} break; } break;
case INT: { case INT: {
return _data._int; return hash_one_uint64((uint64_t)_data._int);
} break; } break;
case FLOAT: { case FLOAT: {
return hash_djb2_one_float(_data._float); return hash_djb2_one_float(_data._float);
@ -2847,8 +2847,8 @@ uint32_t Variant::hash() const {
return hash_djb2_one_float(reinterpret_cast<const Vector2 *>(_data._mem)->y, hash); return hash_djb2_one_float(reinterpret_cast<const Vector2 *>(_data._mem)->y, hash);
} break; } break;
case VECTOR2I: { case VECTOR2I: {
uint32_t hash = hash_djb2_one_32(reinterpret_cast<const Vector2i *>(_data._mem)->x); uint32_t hash = hash_djb2_one_32((uint32_t) reinterpret_cast<const Vector2i *>(_data._mem)->x);
return hash_djb2_one_32(reinterpret_cast<const Vector2i *>(_data._mem)->y, hash); return hash_djb2_one_32((uint32_t) reinterpret_cast<const Vector2i *>(_data._mem)->y, hash);
} break; } break;
case RECT2: { case RECT2: {
uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->position.x); uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->position.x);
@ -2857,10 +2857,10 @@ uint32_t Variant::hash() const {
return hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->size.y, hash); return hash_djb2_one_float(reinterpret_cast<const Rect2 *>(_data._mem)->size.y, hash);
} break; } break;
case RECT2I: { case RECT2I: {
uint32_t hash = hash_djb2_one_32(reinterpret_cast<const Rect2i *>(_data._mem)->position.x); uint32_t hash = hash_djb2_one_32((uint32_t) reinterpret_cast<const Rect2i *>(_data._mem)->position.x);
hash = hash_djb2_one_32(reinterpret_cast<const Rect2i *>(_data._mem)->position.y, hash); hash = hash_djb2_one_32((uint32_t) reinterpret_cast<const Rect2i *>(_data._mem)->position.y, hash);
hash = hash_djb2_one_32(reinterpret_cast<const Rect2i *>(_data._mem)->size.x, hash); hash = hash_djb2_one_32((uint32_t) reinterpret_cast<const Rect2i *>(_data._mem)->size.x, hash);
return hash_djb2_one_32(reinterpret_cast<const Rect2i *>(_data._mem)->size.y, hash); return hash_djb2_one_32((uint32_t) reinterpret_cast<const Rect2i *>(_data._mem)->size.y, hash);
} break; } break;
case TRANSFORM2D: { case TRANSFORM2D: {
uint32_t hash = 5831; uint32_t hash = 5831;
@ -2878,9 +2878,9 @@ uint32_t Variant::hash() const {
return hash_djb2_one_float(reinterpret_cast<const Vector3 *>(_data._mem)->z, hash); return hash_djb2_one_float(reinterpret_cast<const Vector3 *>(_data._mem)->z, hash);
} break; } break;
case VECTOR3I: { case VECTOR3I: {
uint32_t hash = hash_djb2_one_32(reinterpret_cast<const Vector3i *>(_data._mem)->x); uint32_t hash = hash_djb2_one_32((uint32_t) reinterpret_cast<const Vector3i *>(_data._mem)->x);
hash = hash_djb2_one_32(reinterpret_cast<const Vector3i *>(_data._mem)->y, hash); hash = hash_djb2_one_32((uint32_t) reinterpret_cast<const Vector3i *>(_data._mem)->y, hash);
return hash_djb2_one_32(reinterpret_cast<const Vector3i *>(_data._mem)->z, hash); return hash_djb2_one_32((uint32_t) reinterpret_cast<const Vector3i *>(_data._mem)->z, hash);
} break; } break;
case PLANE: { case PLANE: {
uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.x); uint32_t hash = hash_djb2_one_float(reinterpret_cast<const Plane *>(_data._mem)->normal.x);