summaryrefslogtreecommitdiff
path: root/src/stem/lib/bitset.h
blob: fe9e8c246ca52cf8eafa7eb7a9c30ac1a08d0d11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef DEF_BITSET_H
#define DEF_BITSET_H

#include <types.h>

#define INDEX_FROM_BIT(a) (a/(8*4))
#define OFFSET_FROM_BIT(a) (a%(8*4))

struct bitset {
	uint32_t *bits;
	uint32_t size;
};

void bitset_set(struct bitset* t, uint32_t num);
void bitset_clear(struct bitset* t, uint32_t num);
uint32_t bitset_test(struct bitset* t, uint32_t num);
uint32_t bitset_firstFree(struct bitset* t);

#endif