30 lines
1.2 KiB
Markdown
30 lines
1.2 KiB
Markdown
|
# bitmap.h
|
||
|
|
||
|
Utils to handle bitmaps.
|
||
|
|
||
|
# `bitmap_T` - struct
|
||
|
|
||
|
| Name | Type | Description |
|
||
|
|-----------|----------|---------------------------------------|
|
||
|
| size | uint32_t | The size of _buffer_ (in bytes) |
|
||
|
| size_bits | uint32_t | The amount of storable bits |
|
||
|
| buffer | uint8_t* | The buffer, where the bits are stored |
|
||
|
|
||
|
# `bitmap_init_from_buffer(buffer, size)` - function (bitmap_T)
|
||
|
Creates a bitmap object from a given buffer and size
|
||
|
|
||
|
# `bitmap_init(size)` - function (bitmap_T)
|
||
|
Allocates memory to hold a bitmap in the given size and returns a bitmap_T with that buffer and size.
|
||
|
|
||
|
# `bitmap_destruct(bitmap*)` - function (void)
|
||
|
Frees the memory of the given bitmap created with bitmap_init().
|
||
|
|
||
|
# `bitmap_set(bitmap*, index, value)` - function (bool)
|
||
|
Sets the bit at the given index in the given bitmap to the given boolean value.
|
||
|
Returns **false**, if the index is out of the bitmaps size bounds.
|
||
|
Returns **true**, if the operation was successful.
|
||
|
|
||
|
# `bitmap_get(bitmap*, index)` - function (bool)
|
||
|
Returns the boolean value stored at the given index in the given bitmap.
|
||
|
Always returns **false**, if the index is out of the bitmaps size bounds.
|