aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIsraël Hallé <israel.halle@shopify.com>2014-08-04 16:03:09 -0400
committerIsraël Hallé <israel.halle@shopify.com>2014-08-04 23:43:48 -0400
commit7df7437e2dc433902c1ea7a20520a7562c426e34 (patch)
tree43ef5c11bc822fd2bada8e6f523eaaf3a47f81ed
parente53e3dae11a5904194941cfb436b2430673740d1 (diff)
Changes 64 bits family to fast 32 bits
-rw-r--r--entityx/Entity.h6
-rw-r--r--entityx/Event.h2
-rw-r--r--entityx/System.h2
-rw-r--r--entityx/config.h.in5
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 <typename C>
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<C> component(this, id);
BasePool *pool = component_pools_[family];
event_manager_.emit<ComponentRemovedEvent<C>>(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 <stdint.h>
+#include <cstdint>
+#include <cstddef>
namespace entityx {
-static const uint64_t MAX_COMPONENTS = ENTITYX_MAX_COMPONENTS;
+static const size_t MAX_COMPONENTS = ENTITYX_MAX_COMPONENTS;
} // namespace entityx