14#ifndef FECS_SPARSE_PAGE_SIZE
15#define FECS_SPARSE_PAGE_SIZE 2048
34 static constexpr Entity INVALID_ENTITY = std::numeric_limits<Entity>::max();
40 static constexpr std::uint32_t INDEX_BITS = 20;
43 static constexpr std::uint32_t VERSION_BITS = 12;
46 static constexpr std::uint32_t INDEX_MASK = (1u << INDEX_BITS) - 1;
49 static constexpr std::uint32_t VERSION_MASK = ~INDEX_MASK;
52 static constexpr std::uint32_t NPOS = std::numeric_limits<std::uint32_t>::max();
65 return (version << INDEX_BITS) | (index & INDEX_MASK);
75 return e & INDEX_MASK;
85 return (e & VERSION_MASK) >> INDEX_BITS;
Dummy tag component used for tracking global ECS changes (e.g. full view rebuilds).
Definition types.h:24
Entity BuildEntityIndex(std::uint32_t index, std::uint32_t version)
Combines an entity index and version into a single 32-bit entity ID.
Definition types.h:63
#define FECS_SPARSE_PAGE_SIZE
Defines the default number of elements per sparse page, if not specified.
Definition types.h:15
std::uint32_t ComponentIndex
Type alias for identifying component type indices.
Definition types.h:31
std::uint32_t GetEntityIndex(Entity e)
Extracts the index portion from an entity ID.
Definition types.h:73
std::uint32_t Entity
Type alias for entity IDs (32-bit unsigned integer)
Definition types.h:28
std::uint32_t GetEntityVersion(Entity e)
Extracts the verison portion from an entity ID.
Definition types.h:83