Add bitfs_reset()

parent b81832bf
......@@ -42,6 +42,7 @@ struct bitfs {
#define BITFS_MAGIC 0xc18b98bd
uint16_t nbitfss; // length of flexarray (used)
uint16_t lbitfss; // space for flexarray
size_t space; // for reset
size_t nbits;
size_t nset; // count of set bits
struct bitfss s[];
......@@ -59,6 +60,7 @@ bitfs_init(void *p, size_t space)
memset(p, 0, space);
bitfs = p;
bitfs->magic = BITFS_MAGIC;
bitfs->space = space;
space -= sizeof *bitfs;
space /= sizeof *bitfs->s;
......@@ -71,6 +73,15 @@ bitfs_init(void *p, size_t space)
return (bitfs);
}
static inline void
bitfs_reset(struct bitfs *bitfs)
{
CHECK_OBJ_NOTNULL(bitfs, BITFS_MAGIC);
AN(bitfs->space);
bitfs_init(bitfs, bitfs->space);
}
static inline void
bitfs_add(struct bitfs *bitfs, struct bitf *bitf)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment