31 lines
1.4 KiB
Markdown
31 lines
1.4 KiB
Markdown
---
|
|
title: "bitmap.h"
|
|
summary: "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](https://nerdcult.net/projects/noxos/docs/codebase/utils/bitmap.h/#bitmap_t---struct) with that buffer and size.
|
|
|
|
# `bitmap_destruct(bitmap*)` - function (void)
|
|
Frees the memory of the given bitmap created with [bitmap_init](https://nerdcult.net/projects/noxos/docs/codebase/utils/bitmap.h/#bitmap_initsize---function-bitmap_t).
|
|
|
|
# `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.
|