mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 15:08:21 +00:00
bitmap: add BITMAP_DEFINE_STATIC
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#include <util.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
long *data;
|
long *data;
|
||||||
@@ -16,4 +17,11 @@ void bitmap_set_range(bitmap_t *bitmap, long start, long count, int v);
|
|||||||
bool bitmap_get(bitmap_t *bitmap, long idx);
|
bool bitmap_get(bitmap_t *bitmap, long idx);
|
||||||
long bitmap_find_first_set(bitmap_t *bitmap);
|
long bitmap_find_first_set(bitmap_t *bitmap);
|
||||||
|
|
||||||
|
#define BITMAP_DEFINE_STATIC(name, s) \
|
||||||
|
static long entries_bm_##name[ROUND_UP(s, sizeof(long)) / sizeof(long)]; \
|
||||||
|
static bitmap_t name = { \
|
||||||
|
.size = s, \
|
||||||
|
.data = entries_bm_##name \
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user