30#ifndef SQL_BITMAP_INCLUDED
31#define SQL_BITMAP_INCLUDED
40template <u
int default_w
idth>
77 const_cast<uchar *
>(
static_cast<uchar *
>(
static_cast<void *
>(&buf2))),
80 assert(
sizeof(
buffer) >= 4);
82 const_cast<uchar *
>(
static_cast<uchar *
>(
static_cast<void *
>(&buf2))),
83 static_cast<uint32>(map2buff));
93 (map2buff & (1LL << (
sizeof(
ulonglong) * 8 - 1))));
113 const uchar *e = pointer_cast<const uchar *>(&
buffer[0]),
114 *b = e +
sizeof(
buffer) - 1;
115 while (!*b && b > e) b--;
128 static_cast<const uchar *
>(
static_cast<const void *
>(
buffer)));
129 assert(
sizeof(
buffer) >= 4);
131 static_cast<const uchar *
>(
static_cast<const void *
>(
buffer)));
185 return (
map & map2.
map) != 0;
202 if (
map & (1ULL << i))
return i;
215 static const char last_bit[16] = {32, 0, 1, 0, 2, 0, 1, 0,
216 3, 0, 1, 0, 2, 0, 1, 0};
218 while ((bit = last_bit[
bmp & 0xF]) == 32) {
223 bmp &= ~(1LL << bit);
231#elif MAX_INDEXES > 255
232#error "MAX_INDEXES values greater than 255 is not supported."
Definition: sql_bitmap.h:138
char * print(char *buf) const
Definition: sql_bitmap.h:189
bool is_set(uint n) const
Definition: sql_bitmap.h:170
void set_all()
Definition: sql_bitmap.h:163
bool operator==(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:187
void init(uint prefix_to_set)
Definition: sql_bitmap.h:147
void intersect(const Bitmap< 64 > &map2)
Definition: sql_bitmap.h:165
void clear_all()
Definition: sql_bitmap.h:164
void set_bit(uint n)
Definition: sql_bitmap.h:149
uint bits_set() const
Definition: sql_bitmap.h:194
ulonglong to_ulonglong() const
Definition: sql_bitmap.h:193
ulonglong map
Definition: sql_bitmap.h:139
bool is_subset(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:183
void intersect(ulonglong map2)
Definition: sql_bitmap.h:166
uint length() const
Definition: sql_bitmap.h:148
void set_prefix(uint n)
Definition: sql_bitmap.h:157
bool is_overlapping(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:184
bool is_clear_all() const
Definition: sql_bitmap.h:181
bool is_set_all() const
Definition: sql_bitmap.h:182
uint get_first_set() const
Definition: sql_bitmap.h:200
void intersect_extended(ulonglong map2)
Definition: sql_bitmap.h:167
bool operator!=(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:188
void merge(const Bitmap< 64 > &map2)
Definition: sql_bitmap.h:169
void init()
Definition: sql_bitmap.h:146
void subtract(const Bitmap< 64 > &map2)
Definition: sql_bitmap.h:168
bool is_prefix(uint n) const
Definition: sql_bitmap.h:174
void clear_bit(uint n)
Definition: sql_bitmap.h:153
Definition: sql_bitmap.h:41
void intersect(const Bitmap &map2)
Definition: sql_bitmap.h:66
char * print(char *buf) const
Definition: sql_bitmap.h:111
void set_all()
Definition: sql_bitmap.h:64
Bitmap(uint prefix_to_set)
Definition: sql_bitmap.h:49
void intersect_extended(ulonglong map2buff)
Definition: sql_bitmap.h:89
void set_prefix(uint n)
Definition: sql_bitmap.h:63
void clear_all()
Definition: sql_bitmap.h:65
MY_BITMAP map
Definition: sql_bitmap.h:42
bool is_subset(const Bitmap &map2) const
Definition: sql_bitmap.h:101
void clear_bit(uint n)
Definition: sql_bitmap.h:62
void merge(const Bitmap &map2)
Definition: sql_bitmap.h:96
ulonglong to_ulonglong() const
Definition: sql_bitmap.h:125
bool is_set_all() const
Definition: sql_bitmap.h:100
void subtract(const Bitmap &map2)
Definition: sql_bitmap.h:95
bool is_prefix(uint n) const
Definition: sql_bitmap.h:98
Bitmap & operator=(const Bitmap &map2)
Definition: sql_bitmap.h:56
bool is_clear_all() const
Definition: sql_bitmap.h:99
uint length() const
Definition: sql_bitmap.h:55
uint get_first_set() const
Definition: sql_bitmap.h:134
@ ALL_BITS
Definition: sql_bitmap.h:46
uint32 buffer[(default_width+31)/32]
Definition: sql_bitmap.h:43
bool operator!=(const Bitmap &map2) const
Definition: sql_bitmap.h:110
void init()
Definition: sql_bitmap.h:50
void init(uint prefix_to_set)
Definition: sql_bitmap.h:51
bool operator==(const Bitmap &map2) const
Definition: sql_bitmap.h:107
void intersect(ulonglong map2buff)
Definition: sql_bitmap.h:67
Bitmap()
Definition: sql_bitmap.h:47
bool is_set(uint n) const
Definition: sql_bitmap.h:97
bool is_overlapping(const Bitmap &map2) const
Definition: sql_bitmap.h:104
void set_bit(uint n)
Definition: sql_bitmap.h:61
uint bits_set() const
Definition: sql_bitmap.h:133
Bitmap(const Bitmap &from)
Definition: sql_bitmap.h:48
Definition: sql_bitmap.h:208
int next_bit()
Definition: sql_bitmap.h:214
Table_map_iterator(ulonglong t)
Definition: sql_bitmap.h:213
uint no
Definition: sql_bitmap.h:210
ulonglong bmp
Definition: sql_bitmap.h:209
@ BITMAP_END
Definition: sql_bitmap.h:226
#define MAX_INDEXES
Definition: config.h:210
char * longlong2str(int64_t val, char *dst, int radix)
Definition: m_string.h:297
#define MY_BIT_NONE
Definition: my_bitmap.h:32
static bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2)
Quite unlike other C comparison functions ending with 'cmp', e.g.
Definition: my_bitmap.h:108
bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
Definition: my_bitmap.cc:301
static void bitmap_set_all(MY_BITMAP *map)
Definition: my_bitmap.h:128
bool bitmap_is_clear_all(const MY_BITMAP *map)
Definition: my_bitmap.cc:268
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:95
bool bitmap_is_set_all(const MY_BITMAP *map)
Definition: my_bitmap.cc:257
static void bitmap_clear_all(MY_BITMAP *map)
Definition: my_bitmap.h:121
void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:380
uint bitmap_bits_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:416
void bitmap_intersect(MY_BITMAP *to, const MY_BITMAP *from)
Definition: my_bitmap.cc:335
void bitmap_set_above(MY_BITMAP *map, uint from_byte, bool use_bit)
Definition: my_bitmap.cc:372
uint bitmap_get_first_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:439
bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits)
Definition: my_bitmap.cc:140
void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:389
static void bitmap_clear_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:90
void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
Set the specified number of bits in the bitmap buffer.
Definition: my_bitmap.cc:201
bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
Definition: my_bitmap.cc:281
static void bitmap_set_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:80
bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
Definition: my_bitmap.cc:218
Functions for reading and storing in machine-independent format.
void int4store(char *pT, uint32 A)
Definition: my_byteorder.h:173
ulonglong uint8korr(const char *pT)
Definition: my_byteorder.h:157
void int8store(char *pT, ulonglong A)
Definition: my_byteorder.h:185
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:145
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
uint32_t uint32
Definition: my_inttypes.h:67
Definition: buf0block_hint.cc:30
Bitmap< 64 > Key_map
Definition: sql_bitmap.h:230
Definition: my_bitmap.h:43
uint n_bits
Definition: my_bitmap.h:45
unsigned int uint
Definition: uca9-dump.cc:75
int n
Definition: xcom_base.cc:509