Просмотр исходного кода

entity: avoid UBs when id type is std::uint64_t (close #745)

Michele Caini 4 лет назад
Родитель
Сommit
86fccb5071
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      src/entt/entity/entity.hpp

+ 1 - 1
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<entity_type>(version) << traits_type::entity_shift)};
     }
 };