package core:container/bit_array

Index

Constants (0)

This section is empty.

Variables (0)

This section is empty.

Procedure Groups (0)

This section is empty.

Types

Bit_Array ¶

Bit_Array :: struct {
	bits:         [dynamic]u64,
	bias:         int,
	max_index:    int,
	free_pointer: bool,
}

Bit_Array_Iterator ¶

Bit_Array_Iterator :: struct {
	array:    ^Bit_Array,
	word_idx: int,
	bit_idx:  uint,
}

Constants

This section is empty.

Variables

This section is empty.

Procedures

clear ¶

clear :: proc "odin" (ba: ^Bit_Array) {…}
 

Sets all bits to false.

create ¶

create :: proc "odin" (max_index: int, min_index: int = 0, allocator := context.allocator) -> (res: ^Bit_Array, ok: bool) #optional_ok {…}
 

A helper function to create a Bit Array with optional bias, in case your smallest index is non-zero (including negative).

destroy ¶

destroy :: proc "odin" (ba: ^Bit_Array) {…}
 

Releases the memory used by the Bit Array.

get ¶

get :: proc "odin" (ba: ^Bit_Array, #any_int index: uint, allocator := context.allocator) -> (res: bool, ok: bool) {…}
 

In:

	- ba:    ^Bit_Array - a pointer to the Bit Array
	- index: The bit index. Can be an enum member.

Out:
	- res:   The bit you're interested in.
	- ok:    Whether the index was valid. Returns `false` if the index is smaller than the bias.

The `ok` return value may be ignored.

iterate_by_all ¶

iterate_by_all :: proc "odin" (it: ^Bit_Array_Iterator) -> (set: bool, index: int, ok: bool) {…}
 

In:

	- it:    ^Bit_Array_Iterator - the iterator struct that holds the state.

Out:
	- set:    bool - the state of the bit at `index`
	- index:  int - the next bit of the Bit_Array referenced by `it`.
	- ok:	  bool - `true` if the iterator returned a valid index,
		  `false` if there were no more bits

iterate_by_set ¶

iterate_by_set :: proc "odin" (it: ^Bit_Array_Iterator) -> (index: int, ok: bool) {…}
 

In:

	- it:     ^Bit_Array_Iterator - the iterator struct that holds the state.

Out:
	- index:  int - the next set bit of the Bit_Array referenced by `it`.
	- ok:	  bool - `true` if the iterator returned a valid index,
		  `false` if there were no more bits set

iterate_by_unset ¶

iterate_by_unset :: proc "odin" (it: ^Bit_Array_Iterator) -> (index: int, ok: bool) {…}
 

In:

	- it:	  ^Bit_Array_Iterator - the iterator struct that holds the state.

Out:
	- index:  int - the next unset bit of the Bit_Array referenced by `it`.
	- ok:	  bool - `true` if the iterator returned a valid index,
		  `false` if there were no more unset bits

make_iterator ¶

make_iterator :: proc "odin" (ba: ^Bit_Array) -> (it: Bit_Array_Iterator) {…}
 

In:

	- ba:   ^Bit_Array - the array to iterate over

Out:
	- it:   ^Bit_Array_Iterator - the iterator that holds iteration state

set ¶

set :: proc "odin" (ba: ^Bit_Array, #any_int index: uint, allocator := context.allocator) -> (ok: bool) {…}
 

In:

	- ba:    ^Bit_Array - a pointer to the Bit Array
	- index: The bit index. Can be an enum member.

Out:
	- ok:    Whether or not we managed to set requested bit.

`set` automatically resizes the Bit Array to accommodate the requested index if needed.

unset ¶

unset :: proc "odin" (ba: ^Bit_Array, #any_int index: uint, allocator := context.allocator) -> (ok: bool) {…}
 

In:

	- ba:    ^Bit_Array - a pointer to the Bit Array
	- index: The bit index. Can be an enum member.

Out:
	- ok:    Whether or not we managed to unset requested bit.

`unset` automatically resizes the Bit Array to accommodate the requested index if needed.

Procedure Groups

This section is empty.

Source Files

Generation Information

Generated with odin version dev-2023-03 (vendor "odin") Windows_amd64 @ 2023-03-29 21:09:05.434247300 +0000 UTC