MOS Source Code
Loading...
Searching...
No Matches
bitmap.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2
3#pragma once
4
5#include <mos/moslib_global.h>
6#include <mos/types.h>
7
9
10#define BITMAP_LINE_BITS (sizeof(bitmap_line_t) * 8)
11#define BITMAP_LINE_COUNT(size) (ALIGN_UP(size, BITMAP_LINE_BITS) / BITMAP_LINE_BITS)
12
14
15MOSAPI void bitmap_zero(bitmap_line_t *bitmap, size_t bitmap_nlines);
16MOSAPI bool bitmap_set(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index);
17MOSAPI bool bitmap_clear(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index);
18MOSAPI void bitmap_set_range(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t start, size_t end, bool value);
19MOSAPI bool bitmap_get(const bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index);
20
21MOSAPI size_t bitmap_find_first_free_n(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t begin_bit, size_t n_bits);
MOSAPI bool bitmap_get(const bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index)
Definition bitmap.c:46
MOSAPI void bitmap_zero(bitmap_line_t *bitmap, size_t bitmap_nlines)
Definition bitmap.c:15
MOSAPI bitmap_line_t * bitmap_create(size_t size)
Definition bitmap.c:7
MOSAPI bool bitmap_clear(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index)
Definition bitmap.c:33
u32 bitmap_line_t
Definition bitmap.h:8
MOSAPI size_t bitmap_find_first_free_n(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t begin_bit, size_t n_bits)
Definition bitmap.c:55
MOSAPI void bitmap_set_range(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t start, size_t end, bool value)
Definition bitmap.c:105
MOSAPI bool bitmap_set(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index)
Definition bitmap.c:20
#define MOSAPI
Definition mos_global.h:102
size_t size
Definition slab.c:30
unsigned int u32
Definition types.h:21