#define BITSET_WORD GLuint
#define BITSET_WORDBITS (sizeof (BITSET_WORD) * 8)
#define BITSET_DECLARE(name, size) \
BITSET_WORD name[((size) + BITSET_WORDBITS - 1) / BITSET_WORDBITS]
#define BITSET_COPY(x, y) _mesa_memcpy( (x), (y), sizeof (x) )
#define BITSET_EQUAL(x, y) (_mesa_memcmp( (x), (y), sizeof (x) ) == 0)
#define BITSET_ZERO(x) _mesa_memset( (x), 0, sizeof (x) )
#define BITSET_ONES(x) _mesa_memset( (x), 0xff, sizeof (x) )
#define BITSET_BITWORD(b) ((b) / BITSET_WORDBITS)
#define BITSET_BIT(b) (1 << ((b) % BITSET_WORDBITS))
#define BITSET_TEST(x, b) ((x)[BITSET_BITWORD(b)] & BITSET_BIT(b))
#define BITSET_SET(x, b) ((x)[BITSET_BITWORD(b)] |= BITSET_BIT(b))
#define BITSET_CLEAR(x, b) ((x)[BITSET_BITWORD(b)] &= ~BITSET_BIT(b))
#define BITSET_MASK(b) ((b) == BITSET_WORDBITS ? ~0 : BITSET_BIT(b) - 1)
#define BITSET_RANGE(b, e) (BITSET_MASK((e) + 1) & ~BITSET_MASK(b))
#define BITSET_TEST_RANGE(x, b, e) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
((x)[BITSET_BITWORD(b)] & BITSET_RANGE(b, e)) : \
(assert (!"BITSET_TEST_RANGE: bit range crosses word boundary"), 0))
#define BITSET_SET_RANGE(x, b, e) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
((x)[BITSET_BITWORD(b)] |= BITSET_RANGE(b, e)) : \
(assert (!"BITSET_SET_RANGE: bit range crosses word boundary"), 0))
#define BITSET_CLEAR_RANGE(x, b, e) \
(BITSET_BITWORD(b) == BITSET_BITWORD(e) ? \
((x)[BITSET_BITWORD(b)] &= ~BITSET_RANGE(b, e)) : \
(assert (!"BITSET_CLEAR_RANGE: bit range crosses word boundary"), 0))
#define BITSET64_WORD GLuint
#define BITSET64_WORDBITS (sizeof (BITSET64_WORD) * 8)
#define BITSET64_DECLARE(name, size) \
GLuint name[2]
#define BITSET64_COPY(x, y) do { (x)[0] = (y)[0]; (x)[1] = (y)[1]; } while (0)
#define BITSET64_EQUAL(x, y) ( (x)[0] == (y)[0] && (x)[1] == (y)[1] )
#define BITSET64_ZERO(x) do { (x)[0] = 0; (x)[1] = 0; } while (0)
#define BITSET64_ONES(x) do { (x)[0] = 0xFF; (x)[1] = 0xFF; } while (0)
#define BITSET64_BITWORD(b) ((b) / BITSET64_WORDBITS)
#define BITSET64_BIT(b) (1 << ((b) % BITSET64_WORDBITS))
#define BITSET64_TEST(x, b) ((x)[BITSET64_BITWORD(b)] & BITSET64_BIT(b))
#define BITSET64_SET(x, b) ((x)[BITSET64_BITWORD(b)] |= BITSET64_BIT(b))
#define BITSET64_CLEAR(x, b) ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_BIT(b))
#define BITSET64_MASK(b) ((b) == BITSET64_WORDBITS ? ~0 : BITSET64_BIT(b) - 1)
#define BITSET64_RANGE(b, e) (BITSET64_MASK((e) + 1) & ~BITSET64_MASK(b))
#define BITSET64_TEST_RANGE(x, b, e) \
(BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
((x)[BITSET64_BITWORD(b)] & BITSET64_RANGE(b, e)) : \
(assert (!"BITSET64_TEST_RANGE: bit range crosses word boundary"), 0))
#define BITSET64_SET_RANGE(x, b, e) \
(BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
((x)[BITSET64_BITWORD(b)] |= BITSET64_RANGE(b, e)) : \
(assert (!"BITSET64_SET_RANGE: bit range crosses word boundary"), 0))
#define BITSET64_CLEAR_RANGE(x, b, e) \
(BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
((x)[BITSET64_BITWORD(b)] &= ~BITSET64_RANGE(b, e)) : \
(assert (!"BITSET64_CLEAR_RANGE: bit range crosses word boundary"), 0))