core | glapi | vbo | math | shader | swrast | swrast_setup | tnl | tnl_dd

bitset.h File Reference


Detailed Description

Bitset of arbitrary size definitions.

Author:
Michal Krol


Defines

#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)
#define BITSET_SET_RANGE(x, b, e)
#define BITSET_CLEAR_RANGE(x, b, e)
#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)
#define BITSET64_SET_RANGE(x, b, e)
#define BITSET64_CLEAR_RANGE(x, b, e)


Define Documentation

#define BITSET64_BIT (  )     (1 << ((b) % BITSET64_WORDBITS))

#define BITSET64_BITWORD (  )     ((b) / BITSET64_WORDBITS)

#define BITSET64_CLEAR ( x,
 )     ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_BIT(b))

#define BITSET64_CLEAR_RANGE ( x,
b,
 ) 

Value:

(BITSET64_BITWORD(b) == BITSET64_BITWORD(e) ? \
   ((x)[BITSET64_BITWORD(b)] &= ~BITSET64_RANGE(b, e)) : \
   (assert (!"BITSET64_CLEAR_RANGE: bit range crosses word boundary"), 0))

#define BITSET64_COPY ( x,
 )     do { (x)[0] = (y)[0]; (x)[1] = (y)[1]; } while (0)

#define BITSET64_DECLARE ( name,
size   )     GLuint name[2]

#define BITSET64_EQUAL ( x,
 )     ( (x)[0] == (y)[0] && (x)[1] == (y)[1] )

#define BITSET64_MASK (  )     ((b) == BITSET64_WORDBITS ? ~0 : BITSET64_BIT(b) - 1)

#define BITSET64_ONES (  )     do { (x)[0] = 0xFF; (x)[1] = 0xFF; } while (0)

#define BITSET64_RANGE ( b,
 )     (BITSET64_MASK((e) + 1) & ~BITSET64_MASK(b))

#define BITSET64_SET ( x,
 )     ((x)[BITSET64_BITWORD(b)] |= BITSET64_BIT(b))

#define BITSET64_SET_RANGE ( x,
b,
 ) 

Value:

(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_TEST ( x,
 )     ((x)[BITSET64_BITWORD(b)] & BITSET64_BIT(b))

#define BITSET64_TEST_RANGE ( x,
b,
 ) 

Value:

(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_WORD   GLuint

#define BITSET64_WORDBITS   (sizeof (BITSET64_WORD) * 8)

#define BITSET64_ZERO (  )     do { (x)[0] = 0; (x)[1] = 0; } while (0)

#define BITSET_BIT (  )     (1 << ((b) % BITSET_WORDBITS))

#define BITSET_BITWORD (  )     ((b) / BITSET_WORDBITS)

#define BITSET_CLEAR ( x,
 )     ((x)[BITSET_BITWORD(b)] &= ~BITSET_BIT(b))

#define BITSET_CLEAR_RANGE ( x,
b,
 ) 

Value:

(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 BITSET_COPY ( x,
 )     _mesa_memcpy( (x), (y), sizeof (x) )

#define BITSET_DECLARE ( name,
size   )     BITSET_WORD name[((size) + BITSET_WORDBITS - 1) / BITSET_WORDBITS]

#define BITSET_EQUAL ( x,
 )     (_mesa_memcmp( (x), (y), sizeof (x) ) == 0)

#define BITSET_MASK (  )     ((b) == BITSET_WORDBITS ? ~0 : BITSET_BIT(b) - 1)

#define BITSET_ONES (  )     _mesa_memset( (x), 0xff, sizeof (x) )

#define BITSET_RANGE ( b,
 )     (BITSET_MASK((e) + 1) & ~BITSET_MASK(b))

#define BITSET_SET ( x,
 )     ((x)[BITSET_BITWORD(b)] |= BITSET_BIT(b))

#define BITSET_SET_RANGE ( x,
b,
 ) 

Value:

(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_TEST ( x,
 )     ((x)[BITSET_BITWORD(b)] & BITSET_BIT(b))

#define BITSET_TEST_RANGE ( x,
b,
 ) 

Value:

(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_WORD   GLuint

#define BITSET_WORDBITS   (sizeof (BITSET_WORD) * 8)

#define BITSET_ZERO (  )     _mesa_memset( (x), 0, sizeof (x) )


Generated on Sun Sep 27 06:47:45 2009 for Mesa Main by  doxygen 1.5.4