provide BZERO macro for bitsets

This commit is contained in:
Quentin Carbonneaux 2015-11-09 21:34:59 -05:00
parent b5330f2a44
commit 8ed8f1cd4c
5 changed files with 8 additions and 7 deletions

View file

@ -68,6 +68,7 @@ struct Bits {
};
#define BIT(n) (1ul << (n))
#define BZERO(b) ((b) = (Bits){{0}})
#define BGET(b, n) (1&((b).t[n/NBit]>>(n%NBit)))
#define BSET(b, n) ((b).t[n/NBit] |= BIT(n%NBit))
#define BCLR(b, n) ((b).t[n/NBit] &= ~BIT(n%NBit))