54#define TOMMY_ARRAY_BIT 6
92 assert(pos < array->count);
95 bsr = tommy_ilog2(pos | 1);
97 return &array->
bucket[bsr][pos];
Array container type.
Definition: tommyarray.h:60
tommy_size_t count
Number of initialized elements in the array.
Definition: tommyarray.h:63
void ** bucket[TOMMY_SIZE_BIT]
Dynamic array of buckets.
Definition: tommyarray.h:61
tommy_uint_t bucket_bit
Bits used in the bit mask.
Definition: tommyarray.h:64
tommy_size_t bucket_max
Number of buckets.
Definition: tommyarray.h:62
TOMMY_API void tommy_array_grow(tommy_array *array, tommy_size_t size)
Grows the size up to the specified value.
void tommy_array_set(tommy_array *array, tommy_size_t pos, void *element)
Sets the element at the specified position.
Definition: tommyarray.h:105
TOMMY_API tommy_size_t tommy_array_memory_usage(tommy_array *array)
Gets the size of allocated memory.
void * tommy_array_get(tommy_array *array, tommy_size_t pos)
Gets the element at the specified position.
Definition: tommyarray.h:115
void ** tommy_array_ref(tommy_array *array, tommy_size_t pos)
Gets a reference of the element at the specified position.
Definition: tommyarray.h:88
void tommy_array_insert(tommy_array *array, void *element)
Grows and inserts a new element at the end of the array.
Definition: tommyarray.h:123
TOMMY_API void tommy_array_done(tommy_array *array)
Deinitializes the array.
tommy_size_t tommy_array_size(tommy_array *array)
Gets the initialized size of the array.
Definition: tommyarray.h:135
struct tommy_array_struct tommy_array
Array container type.
TOMMY_API void tommy_array_init(tommy_array *array)
Initializes the array.
uint64_t tommy_size_t
Generic size_t type.
Definition: tommytypes.h:60
tommy_uint32_t tommy_uint_t
Generic unsigned integer type.
Definition: tommytypes.h:80