24 if (
line >= bitmap_nlines)
27 bool original =
bitmap_get(bitmap, bitmap_nlines, index);
30 return original ==
false;
37 if (
line >= bitmap_nlines)
40 bool original =
bitmap_get(bitmap, bitmap_nlines, index);
43 return original ==
true;
50 if (
line >= bitmap_nlines)
61 for (
size_t line_i = target_starting_line; free_bits < n_bits; line_i++)
63 if (line_i >= bitmap_nlines)
76 target_starting_line = line_i + 1;
78 target_starting_bit = 0;
84 if (free_bits >= n_bits)
96 target_starting_bit = bit + 1;
97 target_starting_line = line_i;
112 if (start_line >= bitmap_nlines || end_line >= bitmap_nlines)
115 if (start_line == end_line)
119 mask <<= start_bit_in_line;
124 bitmap[start_line] =
line;
130 mask <<= start_bit_in_line;
135 bitmap[start_line] =
line;
137 for (
size_t i = start_line + 1; i < end_line; i++)
145 line = bitmap[end_line];
151 bitmap[end_line] =
line;
bool bitmap_clear(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index)
bitmap_line_t * bitmap_create(size_t size)
bool bitmap_set(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index)
void bitmap_zero(bitmap_line_t *bitmap, size_t bitmap_nlines)
size_t bitmap_find_first_free_n(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t begin_bit, size_t n_bits)
void bitmap_set_range(bitmap_line_t *bitmap, size_t bitmap_nlines, size_t start_bit, size_t end_bit, bool value)
bool bitmap_get(const bitmap_line_t *bitmap, size_t bitmap_nlines, size_t index)
#define BITMAP_LINE_COUNT(size)
#define memzero(ptr, size)