From 7df7437e2dc433902c1ea7a20520a7562c426e34 Mon Sep 17 00:00:00 2001 From: Israël Hallé Date: Mon, 4 Aug 2014 16:03:09 -0400 Subject: Changes 64 bits family to fast 32 bits --- entityx/Entity.h | 6 +++--- entityx/Event.h | 2 +- entityx/System.h | 2 +- entityx/config.h.in | 5 +++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/entityx/Entity.h b/entityx/Entity.h index e36d761..e4192db 100644 --- a/entityx/Entity.h +++ b/entityx/Entity.h @@ -212,7 +212,7 @@ private: */ struct BaseComponent { public: - typedef uint64_t Family; + typedef size_t Family; // NOTE: Component memory is *always* managed by the EntityManager. // Use Entity::destroy() instead. @@ -519,8 +519,8 @@ class EntityManager : entityx::help::NonCopyable { template void remove(Entity::Id id) { assert_valid(id); - const int family = C::family(); - const int index = id.index(); + const BaseComponent::Family family = C::family(); + const uint32_t index = id.index(); ComponentHandle component(this, id); BasePool *pool = component_pools_[family]; event_manager_.emit>(Entity(this, id), component); diff --git a/entityx/Event.h b/entityx/Event.h index f830be0..f238497 100644 --- a/entityx/Event.h +++ b/entityx/Event.h @@ -26,7 +26,7 @@ namespace entityx { /// Used internally by the EventManager. class BaseEvent { public: - typedef uint64_t Family; + typedef size_t Family; virtual ~BaseEvent() {} diff --git a/entityx/System.h b/entityx/System.h index d94c91a..4854b8d 100644 --- a/entityx/System.h +++ b/entityx/System.h @@ -32,7 +32,7 @@ class SystemManager; */ class BaseSystem : entityx::help::NonCopyable { public: - typedef uint64_t Family; + typedef size_t Family; virtual ~BaseSystem() {} diff --git a/entityx/config.h.in b/entityx/config.h.in index 575b34f..e76e4df 100644 --- a/entityx/config.h.in +++ b/entityx/config.h.in @@ -2,10 +2,11 @@ #cmakedefine ENTITYX_MAX_COMPONENTS @ENTITYX_MAX_COMPONENTS@ -#include +#include +#include namespace entityx { -static const uint64_t MAX_COMPONENTS = ENTITYX_MAX_COMPONENTS; +static const size_t MAX_COMPONENTS = ENTITYX_MAX_COMPONENTS; } // namespace entityx -- cgit v1.2.3