def reserve
bendvy-ecs-core@0.1.0.3 · entity_allocator.bend:95
import bendvy-ecs-core@0.1.0.3/entity_allocator.bend as EntityAllocator
import Base
95def reserve(allocator:Allocator) -> Allocator & Reservation:
96 match allocator:
97 case Allocator{+next,high,slots,+capacity,depth,[],order}:reserve_fresh(U32.is_lt(next,131073),Bool.not(U32.is_lt(next,capacity)),Allocator{next,high,slots,capacity,depth,[],order})
98 case Allocator{+next,+high,slots,+capacity,+depth,+index <> free,+order}:reserve_recycled(index,next,high,capacity,depth,free,order,Array.get(Slot,slots,index))