xref: /freebsd/contrib/wpa/src/utils/bitfield.h (revision 416ba5c74546f32a993436a99516d35008e9f384)
1*5b9c547cSRui Paulo /*
2*5b9c547cSRui Paulo  * Bitfield
3*5b9c547cSRui Paulo  * Copyright (c) 2013, Jouni Malinen <j@w1.fi>
4*5b9c547cSRui Paulo  *
5*5b9c547cSRui Paulo  * This software may be distributed under the terms of the BSD license.
6*5b9c547cSRui Paulo  * See README for more details.
7*5b9c547cSRui Paulo  */
8*5b9c547cSRui Paulo 
9*5b9c547cSRui Paulo #ifndef BITFIELD_H
10*5b9c547cSRui Paulo #define BITFIELD_H
11*5b9c547cSRui Paulo 
12*5b9c547cSRui Paulo struct bitfield;
13*5b9c547cSRui Paulo 
14*5b9c547cSRui Paulo struct bitfield * bitfield_alloc(size_t max_bits);
15*5b9c547cSRui Paulo void bitfield_free(struct bitfield *bf);
16*5b9c547cSRui Paulo void bitfield_set(struct bitfield *bf, size_t bit);
17*5b9c547cSRui Paulo void bitfield_clear(struct bitfield *bf, size_t bit);
18*5b9c547cSRui Paulo int bitfield_is_set(struct bitfield *bf, size_t bit);
19*5b9c547cSRui Paulo int bitfield_get_first_zero(struct bitfield *bf);
20*5b9c547cSRui Paulo 
21*5b9c547cSRui Paulo #endif /* BITFIELD_H */
22