24 #define DRWN_INT_BIT_SIZE (8*sizeof(int))
25 #define DRWN_BIT_GET(x,b) ( ( (x)[(b)/DRWN_INT_BIT_SIZE] & (1<<((b)%DRWN_INT_BIT_SIZE)) ) != 0 )
26 #define DRWN_BIT_SET(x,b) ( (x)[(b)/DRWN_INT_BIT_SIZE] |= (1<<((b)%DRWN_INT_BIT_SIZE)) )
27 #define DRWN_BIT_CLEAR(x,b) ( (x)[(b)/DRWN_INT_BIT_SIZE] &= (unsigned int)(-1) - (1<<((b)%DRWN_INT_BIT_SIZE)) )
28 #define DRWN_BIT_FLIP(x,b) ( (x)[(b)/DRWN_INT_BIT_SIZE] ^= (1<<((b)%DRWN_INT_BIT_SIZE)) )
29 #define DRWN_BITMAP_SIZE(x) int( ((x+DRWN_INT_BIT_SIZE-1)/DRWN_INT_BIT_SIZE) )
44 static const int NUMSETLOOKUP[256];
59 inline bool empty()
const {
return (_sz == 0); }
61 inline int size()
const {
return _sz; }
66 inline bool get(
int i)
const {
return DRWN_BIT_GET(_map, i); }
68 inline void set(
int i) { DRWN_BIT_SET(_map, i); }
70 inline void clear(
int i) { DRWN_BIT_CLEAR(_map, i); }
72 inline void flip(
int i) { DRWN_BIT_FLIP(_map, i); }
100 inline bool operator[](
int i)
const {
return DRWN_BIT_GET(_map, i); }
103 void print(ostream &os = cout,
int stride = -1)
const;
int _map_sz
size of the array in words
Definition: drwnBitArray.h:46
int size() const
returns the number of bits in the array
Definition: drwnBitArray.h:61
int _mask
mask for the last word in _map
Definition: drwnBitArray.h:48
void set(int i)
sets the i-th bit of the array to true
Definition: drwnBitArray.h:68
void flip(int i)
negates the i-th bit of the array
Definition: drwnBitArray.h:72
Implements an efficient packed array of bits.
Definition: drwnBitArray.h:42
bool empty() const
returns true if the array is empty
Definition: drwnBitArray.h:59
void clear(int i)
sets the i-th bit of the array to false
Definition: drwnBitArray.h:70
bool operator[](int i) const
returns true if the i-th bit of the array is set (see drwnBitArray::get)
Definition: drwnBitArray.h:100
int * _map
storage for the array
Definition: drwnBitArray.h:47
bool operator==(const CvRect &r, const CvRect &s)
equality operator for CvRect objects
Definition: drwnOpenCVUtils.cpp:83
int _sz
size of the array in bits
Definition: drwnBitArray.h:45