99 // The index of the first full word in a range.
100 idx_t word_index_round_up(idx_t bit) const;
101
102 // Verification.
103 inline void verify_index(idx_t index) const NOT_DEBUG_RETURN;
104 inline void verify_range(idx_t beg_index, idx_t end_index) const
105 NOT_DEBUG_RETURN;
106
107 // Statistics.
108 static idx_t* _pop_count_table;
109 static void init_pop_count_table();
110 static idx_t num_set_bits(bm_word_t w);
111 static idx_t num_set_bits_from_table(unsigned char c);
112
113 public:
114
115 // Constructs a bitmap with no map, and size 0.
116 BitMap() : _map(NULL), _size(0) {}
117
118 // Constructs a bitmap with the given map and size.
119 BitMap(bm_word_t* map, idx_t size_in_bits);
120
121 // Constructs an empty bitmap of the given size (that is, this clears the
122 // new bitmap). Allocates the map array in resource area if
123 // "in_resource_area" is true, else in the C heap.
124 BitMap(idx_t size_in_bits, bool in_resource_area = true);
125
126 // Set the map and size.
127 void set_map(bm_word_t* map) { _map = map; }
128 void set_size(idx_t size_in_bits) { _size = size_in_bits; }
129
130 // Allocates necessary data structure, either in the resource area
131 // or in the C heap, as indicated by "in_resource_area."
132 // Preserves state currently in bit map by copying data.
133 // Zeros any newly-addressable bits.
134 // If "in_resource_area" is false, frees the current map.
135 // (Note that this assumes that all calls to "resize" on the same BitMap
136 // use the same value for "in_resource_area".)
137 void resize(idx_t size_in_bits, bool in_resource_area = true);
138
139 // Accessing
|
99 // The index of the first full word in a range.
100 idx_t word_index_round_up(idx_t bit) const;
101
102 // Verification.
103 inline void verify_index(idx_t index) const NOT_DEBUG_RETURN;
104 inline void verify_range(idx_t beg_index, idx_t end_index) const
105 NOT_DEBUG_RETURN;
106
107 // Statistics.
108 static idx_t* _pop_count_table;
109 static void init_pop_count_table();
110 static idx_t num_set_bits(bm_word_t w);
111 static idx_t num_set_bits_from_table(unsigned char c);
112
113 public:
114
115 // Constructs a bitmap with no map, and size 0.
116 BitMap() : _map(NULL), _size(0) {}
117
118 // Constructs a bitmap with the given map and size.
119 BitMap(bm_word_t* map, idx_t size_in_bits) :_map(map), _size(size_in_bits) {}
120
121 // Constructs an empty bitmap of the given size (that is, this clears the
122 // new bitmap). Allocates the map array in resource area if
123 // "in_resource_area" is true, else in the C heap.
124 BitMap(idx_t size_in_bits, bool in_resource_area = true);
125
126 // Set the map and size.
127 void set_map(bm_word_t* map) { _map = map; }
128 void set_size(idx_t size_in_bits) { _size = size_in_bits; }
129
130 // Allocates necessary data structure, either in the resource area
131 // or in the C heap, as indicated by "in_resource_area."
132 // Preserves state currently in bit map by copying data.
133 // Zeros any newly-addressable bits.
134 // If "in_resource_area" is false, frees the current map.
135 // (Note that this assumes that all calls to "resize" on the same BitMap
136 // use the same value for "in_resource_area".)
137 void resize(idx_t size_in_bits, bool in_resource_area = true);
138
139 // Accessing
|