Pārlūkot izejas kodu

entity: try to make all compilers happy again

Michele Caini 2 gadi atpakaļ
vecāks
revīzija
dc424f7d4c
1 mainītis faili ar 12 papildinājumiem un 12 dzēšanām
  1. 12 12
      src/entt/entity/entity.hpp

+ 12 - 12
src/entt/entity/entity.hpp

@@ -106,10 +106,10 @@ public:
      * @return The integral representation of the version part.
      * @return The integral representation of the version part.
      */
      */
     [[nodiscard]] static constexpr version_type to_version(const value_type value) noexcept {
     [[nodiscard]] static constexpr version_type to_version(const value_type value) noexcept {
-        if constexpr(Traits::version_mask) {
-            return (static_cast<version_type>(to_integral(value) >> length) & version_mask);
-        } else {
+        if constexpr(Traits::version_mask == 0u) {
             return version_type{};
             return version_type{};
+        } else {
+            return (static_cast<version_type>(to_integral(value) >> length) & version_mask);
         }
         }
     }
     }
 
 
@@ -134,10 +134,10 @@ public:
      * @return A properly constructed identifier.
      * @return A properly constructed identifier.
      */
      */
     [[nodiscard]] static constexpr value_type construct(const entity_type entity, const version_type version) noexcept {
     [[nodiscard]] static constexpr value_type construct(const entity_type entity, const version_type version) noexcept {
-        if constexpr(Traits::version_mask) {
-            return value_type{(entity & entity_mask) | (static_cast<entity_type>(version & version_mask) << length)};
-        } else {
+        if constexpr(Traits::version_mask == 0u) {
             return value_type{entity & entity_mask};
             return value_type{entity & entity_mask};
+        } else {
+            return value_type{(entity & entity_mask) | (static_cast<entity_type>(version & version_mask) << length)};
         }
         }
     }
     }
 
 
@@ -152,10 +152,10 @@ public:
      * @return A properly constructed identifier.
      * @return A properly constructed identifier.
      */
      */
     [[nodiscard]] static constexpr value_type combine(const entity_type lhs, const entity_type rhs) noexcept {
     [[nodiscard]] static constexpr value_type combine(const entity_type lhs, const entity_type rhs) noexcept {
-        if constexpr(Traits::version_mask) {
-            return value_type{(lhs & entity_mask) | (rhs & (version_mask << length))};
-        } else {
+        if constexpr(Traits::version_mask == 0u) {
             return value_type{lhs & entity_mask};
             return value_type{lhs & entity_mask};
+        } else {
+            return value_type{(lhs & entity_mask) | (rhs & (version_mask << length))};
         }
         }
     }
     }
 };
 };
@@ -327,10 +327,10 @@ struct tombstone_t {
     [[nodiscard]] constexpr bool operator==(const Entity entity) const noexcept {
     [[nodiscard]] constexpr bool operator==(const Entity entity) const noexcept {
         using traits_type = entt_traits<Entity>;
         using traits_type = entt_traits<Entity>;
 
 
-        if constexpr(traits_type::version_mask) {
-            return (traits_type::to_version(entity) == traits_type::to_version(*this));
-        } else {
+        if constexpr(traits_type::version_mask == 0u) {
             return false;
             return false;
+        } else {
+            return (traits_type::to_version(entity) == traits_type::to_version(*this));
         }
         }
     }
     }