C Library fit arbitrary length bitstrings
struct bitset {
unsigned int size;
unsigned char *bits;
};
The size
field says how many bits, and the bits
field holds the actual bitstring as a series of characters.
create a new bitset struct with enough space to hold numbits
bits.
free the memory previously allocated to the bitset b
.
Return the bit at position i
of the bitset b
.
These two functions set the bit at position i
to one in bitset_set
or sets it to zero in bitset_clear
.