Crate sparse_mem

Source

Functions§

alignment
Alignment requirement for the sparse array. Report 4 just for the benefit of values
allocate
Allocate a new ID and generation.
element_count
Get current element count
element_size
Get current element size
generation_ptr_const
id_to_slot_ptr
Get a pointer to the id_to_slot array (forward lookup)
id_to_slot_ptr_const
init
Initialize the sparse array to memory specified by the raw memory pointer. base must point to a region of at least layout_size(capacity, element_size) bytes.
insert
Insert raw bytes at handle id
is_alive
Check handle validity
layout_size
Compute total bytes needed in memory for a sparse array. Used for code generator to know how much space to reserve.
remove
Remove by handle; frees slot and bumps generation. Returns false on mismatching generations.
slot_to_id_ptr
Get a pointer to the slot_to_id array (reverse lookup)
slot_to_id_ptr_const
Get a pointer to the slot_to_id array (reverse lookup)
values_offset
Compute offset of values region (values are aligned to 8 bytes)