FLAGS_ADD

This commit is contained in:
Ukendio 2024-07-14 07:16:24 +02:00
parent 8a7b3de004
commit 43a19f5328

View file

@ -26,7 +26,6 @@ type Archetype = {
columns: { Column }, columns: { Column },
records: { [number]: number }, records: { [number]: number },
} }
type Record = { type Record = {
archetype: Archetype, archetype: Archetype,
row: number, row: number,
@ -79,23 +78,23 @@ local ECS_ID_FLAGS_MASK = 0x10
local ECS_ENTITY_MASK = bit32.lshift(1, 24) local ECS_ENTITY_MASK = bit32.lshift(1, 24)
local ECS_GENERATION_MASK = bit32.lshift(1, 16) local ECS_GENERATION_MASK = bit32.lshift(1, 16)
local function addFlags(isPair: boolean): number local function FLAGS_ADD(is_pair: boolean): number
local typeFlags = 0x0 local flags = 0x0
if isPair then if is_pair then
typeFlags = bit32.bor(typeFlags, ECS_PAIR_FLAG) -- HIGHEST bit in the ID. flags = bit32.bor(flags, ECS_PAIR_FLAG) -- HIGHEST bit in the ID.
end end
if false then if false then
typeFlags = bit32.bor(typeFlags, 0x4) -- Set the second flag to true flags = bit32.bor(flags, 0x4) -- Set the second flag to true
end end
if false then if false then
typeFlags = bit32.bor(typeFlags, 0x2) -- Set the third flag to true flags = bit32.bor(flags, 0x2) -- Set the third flag to true
end end
if false then if false then
typeFlags = bit32.bor(typeFlags, 0x1) -- LAST BIT in the ID. flags = bit32.bor(flags, 0x1) -- LAST BIT in the ID.
end end
return typeFlags return flags
end end
local function ECS_COMBINE(source: number, target: number): i53 local function ECS_COMBINE(source: number, target: number): i53
@ -137,7 +136,7 @@ local function STRIP_GENERATION(e: i53): i24
end end
local function ECS_PAIR(pred: i53, obj: i53): i53 local function ECS_PAIR(pred: i53, obj: i53): i53
return ECS_COMBINE(ECS_ENTITY_T_LO(obj), ECS_ENTITY_T_LO(pred)) + addFlags(--[[isPair]] true) :: i53 return ECS_COMBINE(ECS_ENTITY_T_LO(obj), ECS_ENTITY_T_LO(pred)) + FLAGS_ADD(--[[isPair]] true) :: i53
end end
local ERROR_ENTITY_NOT_ALIVE = "Entity is not alive" local ERROR_ENTITY_NOT_ALIVE = "Entity is not alive"