toaruos/base/usr/include/kernel/bitset.h

20 lines
428 B
C
Raw Normal View History

2018-03-16 15:56:19 +03:00
/* vim: tabstop=4 shiftwidth=4 noexpandtab
*/
#pragma once
2018-03-19 05:38:11 +03:00
#include <kernel/system.h>
2018-03-16 15:56:19 +03:00
typedef struct {
unsigned char *data;
size_t size;
} bitset_t;
void bitset_init(bitset_t *set, size_t size);
void bitset_free(bitset_t *set);
void bitset_set(bitset_t *set, size_t bit);
void bitset_clear(bitset_t *set, size_t bit);
int bitset_test(bitset_t *set, size_t bit);
/* Find first unset bit */
int bitset_ffub(bitset_t *set);