forked from NLnetLabs/nsd
-
Notifications
You must be signed in to change notification settings - Fork 3
/
bitset.h
40 lines (29 loc) · 842 Bytes
/
bitset.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* bitset.h -- Dynamic bitset.
*
* Copyright (c) 2001-2020, NLnet Labs. All rights reserved.
*
* See LICENSE for the license.
*
*/
#ifndef BITSET_H
#define BITSET_H
#include <assert.h>
#include <limits.h>
#include <string.h>
typedef struct nsd_bitset nsd_bitset_type;
struct nsd_bitset {
size_t size; /** Number of available bits in the set */
unsigned char bits[];
};
size_t nsd_bitset_size(size_t bits);
void nsd_bitset_zero(struct nsd_bitset *bset);
void nsd_bitset_init(struct nsd_bitset *bset, size_t bits);
int nsd_bitset_isset(struct nsd_bitset *bset, size_t bit);
void nsd_bitset_set(struct nsd_bitset *bset, size_t bit);
void nsd_bitset_unset(struct nsd_bitset *bset, size_t bit);
void nsd_bitset_or(
struct nsd_bitset *destset,
struct nsd_bitset *srcset1,
struct nsd_bitset *srcset2);
#endif /* BITSET_H */