Bit_Array module

init_bit_array

procedureSource

Sets up array to hold count bits, all cleared, replacing whatever it was. Allocates the words with the array's allocator, taking context.allocator if it has none.

Use it on a Bit_Array that holds no storage, such as a zeroed one or one after deinit; storage it already owned would leak. A negative count fails an assert.

Example↗
bits: Bit_Array;
init_bit_array(*bits, 16);
assert(bits.count == 16 && !bits[3]);
deinit(*bits);
init_bit_array :: (array: *Bit_Array, count: int)

Parameters

array: *Bit_Array
count: int

See also