diff options
Diffstat (limited to 'src/bitset.h')
| -rw-r--r-- | src/bitset.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/bitset.h b/src/bitset.h new file mode 100644 index 0000000..0c5092d --- /dev/null +++ b/src/bitset.h @@ -0,0 +1,44 @@ +#ifndef bitset_h_INCLUDED +#define bitset_h_INCLUDED + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifndef BITSET_BYTES +#define BITSET_BYTES 4 +#endif + +typedef struct +{ + int size; + char *arena; +} bitarena_t; + +typedef char* bitset_t; + +void +bitarena_init(bitarena_t *arena, int size); + +bitset_t +bitarena_at(bitarena_t *arena, int idx); + +bitset_t +bitset_and(bitset_t b1, bitset_t b2); + +int +bitset_isZero(bitset_t bitset); + +void +bitset_set(bitset_t bitset, int position); + +void +bitset_unset(bitset_t bitset, int position); + +int +bitset_equals(bitset_t b1, bitset_t b2); + +void +bitset_print(bitset_t bitset); + +#endif // bitset_h_INCLUDED |