From 11b94fb95a9932a4f4a6035af012407c895837da Mon Sep 17 00:00:00 2001 From: obhi-d Date: Tue, 22 Oct 2024 08:07:39 +0200 Subject: [PATCH] MSVC throwing error on the legit shift. --- include/acl/ecs/entity.hpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/acl/ecs/entity.hpp b/include/acl/ecs/entity.hpp index 8ec877f..a8b07fa 100644 --- a/include/acl/ecs/entity.hpp +++ b/include/acl/ecs/entity.hpp @@ -23,8 +23,19 @@ class basic_entity static constexpr size_type nb_revision_bits = RevisionBits; static constexpr size_type nb_usable_bits = (sizeof(size_type) * 8 - nb_revision_bits); static constexpr size_type index_mask_v = std::numeric_limits::max() >> nb_revision_bits; - static constexpr size_type revision_mask_v = std::numeric_limits::max() << nb_usable_bits; - static constexpr size_type version_inc_v = 1 << nb_usable_bits; + static constexpr size_type revision_mask_v = []() -> size_type + { + if constexpr (nb_revision_bits > 0) + return std::numeric_limits::max() << nb_usable_bits; + return 0; + }(); + static constexpr size_type version_inc_v = []() -> size_type + { + constexpr size_type one = 1; + if constexpr (nb_revision_bits > 0) + return one << nb_usable_bits; + return 0; + }(); constexpr basic_entity() noexcept = default; constexpr basic_entity(basic_entity const& i) noexcept = default;