From 86fccb5071303dfca5e77e64376d9e88f09dbfba Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 26 Jul 2021 23:25:38 +0200 Subject: [PATCH] entity: avoid UBs when id type is std::uint64_t (close #745) --- src/entt/entity/entity.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/entt/entity/entity.hpp b/src/entt/entity/entity.hpp index 1f478948f..318c2ac22 100644 --- a/src/entt/entity/entity.hpp +++ b/src/entt/entity/entity.hpp @@ -126,7 +126,7 @@ public: * @return A properly constructed identifier. */ [[nodiscard]] static constexpr value_type construct(const entity_type entity = traits_type::entity_mask, const version_type version = traits_type::version_mask) ENTT_NOEXCEPT { - return value_type{(entity & traits_type::entity_mask) | (version << traits_type::entity_shift)}; + return value_type{(entity & traits_type::entity_mask) | (static_cast(version) << traits_type::entity_shift)}; } };