From aa84774c2b45bc7ff0ac0827a0ee0c218b892e04 Mon Sep 17 00:00:00 2001 From: github_actions Date: Fri, 22 Mar 2024 20:44:56 +0000 Subject: [PATCH] Automated single-include header generation --- include/ecs/ecs.ixx | 62 +++++++------------------------------------- include/ecs/ecs_sh.h | 62 +++++++------------------------------------- 2 files changed, 18 insertions(+), 106 deletions(-) diff --git a/include/ecs/ecs.ixx b/include/ecs/ecs.ixx index 4da27a12..e4c74d1b 100644 --- a/include/ecs/ecs.ixx +++ b/include/ecs/ecs.ixx @@ -1729,62 +1729,16 @@ private: static_assert(!is_parent::value, "can not have pools of any ecs::parent"); struct chunk { - chunk() noexcept = default; - chunk(chunk const&) = delete; - chunk(chunk&& other) noexcept - : range{other.range}, active{other.active}, data{other.data} { - other.data = nullptr; - } - chunk& operator=(chunk const&) = delete; - chunk& operator=(chunk&& other) noexcept { - range = other.range; - active = other.active; - data = other.data; - other.data = nullptr; - return *this; - } - chunk(entity_range range_, entity_range active_, T* data_ = nullptr, bool owns_data_ = false, - bool has_split_data_ = false) noexcept - : range(range_), active(active_), data(data_) { - set_owns_data(owns_data_); - set_has_split_data(has_split_data_); - } - - // The full range this chunk covers. + // The range this chunk covers. entity_range range; - // The partial range of active entities inside this chunk - entity_range active; - - // The data for the full range of the chunk (range.count()) - // Tagged: - // bit1 = owns data - // bit2 = has split data - tagged_pointer data; - - // Signals if this chunk owns this data and should clean it up - void set_owns_data(bool owns) noexcept { - if (owns) - data.set_bit1(); - else - data.clear_bit1(); - } - bool get_owns_data() const noexcept { - return data.test_bit1(); - } + // The data for the full range of the chunk + T* data; - // Signals if this chunk has been split - void set_has_split_data(bool split) noexcept { - if (split) - data.set_bit2(); - else - data.clear_bit2(); - } - bool get_has_split_data() const noexcept { - return data.test_bit2(); - } + // Skip list stuff + std::array next; }; - static_assert(sizeof(chunk) == 24); + static_assert(sizeof(chunk) == 32); // struct entity_empty { @@ -1813,6 +1767,8 @@ private: using chunk_iter = typename std::vector::iterator; using chunk_const_iter = typename std::vector::const_iterator; + array_scatter_allocator as_alloc; + array_scatter_allocator chunk_alloc; std::vector chunks; std::vector variants; @@ -1864,7 +1820,7 @@ public: // This condition will not be checked until 'process_changes' is called. // Pre: range and span must be same size. void add_span(entity_range const range, std::span span) noexcept requires(!detail::unbound) { - //Pre(range.count() == std::ssize(span), "range and span must be same size"); + Pre(range.count() == std::ssize(span), "range and span must be same size"); remove_from_variants(range); // Add the range and function to a temp storage deferred_spans.local().emplace_back(range, span); diff --git a/include/ecs/ecs_sh.h b/include/ecs/ecs_sh.h index f14730b2..ebd7b789 100644 --- a/include/ecs/ecs_sh.h +++ b/include/ecs/ecs_sh.h @@ -1730,62 +1730,16 @@ class component_pool final : public component_pool_base { static_assert(!is_parent::value, "can not have pools of any ecs::parent"); struct chunk { - chunk() noexcept = default; - chunk(chunk const&) = delete; - chunk(chunk&& other) noexcept - : range{other.range}, active{other.active}, data{other.data} { - other.data = nullptr; - } - chunk& operator=(chunk const&) = delete; - chunk& operator=(chunk&& other) noexcept { - range = other.range; - active = other.active; - data = other.data; - other.data = nullptr; - return *this; - } - chunk(entity_range range_, entity_range active_, T* data_ = nullptr, bool owns_data_ = false, - bool has_split_data_ = false) noexcept - : range(range_), active(active_), data(data_) { - set_owns_data(owns_data_); - set_has_split_data(has_split_data_); - } - - // The full range this chunk covers. + // The range this chunk covers. entity_range range; - // The partial range of active entities inside this chunk - entity_range active; - - // The data for the full range of the chunk (range.count()) - // Tagged: - // bit1 = owns data - // bit2 = has split data - tagged_pointer data; - - // Signals if this chunk owns this data and should clean it up - void set_owns_data(bool owns) noexcept { - if (owns) - data.set_bit1(); - else - data.clear_bit1(); - } - bool get_owns_data() const noexcept { - return data.test_bit1(); - } + // The data for the full range of the chunk + T* data; - // Signals if this chunk has been split - void set_has_split_data(bool split) noexcept { - if (split) - data.set_bit2(); - else - data.clear_bit2(); - } - bool get_has_split_data() const noexcept { - return data.test_bit2(); - } + // Skip list stuff + std::array next; }; - static_assert(sizeof(chunk) == 24); + static_assert(sizeof(chunk) == 32); // struct entity_empty { @@ -1814,6 +1768,8 @@ class component_pool final : public component_pool_base { using chunk_iter = typename std::vector::iterator; using chunk_const_iter = typename std::vector::const_iterator; + array_scatter_allocator as_alloc; + array_scatter_allocator chunk_alloc; std::vector chunks; std::vector variants; @@ -1865,7 +1821,7 @@ class component_pool final : public component_pool_base { // This condition will not be checked until 'process_changes' is called. // Pre: range and span must be same size. void add_span(entity_range const range, std::span span) noexcept requires(!detail::unbound) { - //Pre(range.count() == std::ssize(span), "range and span must be same size"); + Pre(range.count() == std::ssize(span), "range and span must be same size"); remove_from_variants(range); // Add the range and function to a temp storage deferred_spans.local().emplace_back(range, span);