30#ifndef SQL_BITMAP_INCLUDED
31#define SQL_BITMAP_INCLUDED
42template <u
int default_w
idth>
51 explicit Bitmap(uint prefix_to_set) {
init(prefix_to_set); }
53 void init(uint prefix_to_set) {
57 uint
length()
const {
return default_width; }
79 const_cast<uchar *
>(
static_cast<uchar *
>(
static_cast<void *
>(&buf2))),
82 assert(
sizeof(
buffer) >= 4);
84 const_cast<uchar *
>(
static_cast<uchar *
>(
static_cast<void *
>(&buf2))),
85 static_cast<uint32>(map2buff));
95 (map2buff & (1LL << (
sizeof(
ulonglong) * 8 - 1))));
115 const uchar *e = pointer_cast<const uchar *>(&
buffer[0]);
117 while (*b == 0 && b > e) {
135 static_cast<const uchar *
>(
static_cast<const void *
>(
buffer)));
136 assert(
sizeof(
buffer) >= 4);
138 static_cast<const uchar *
>(
static_cast<const void *
>(
buffer)));
201 return (
map & map2.
map) != 0;
218 if (
map & (1ULL << i))
return i;
228 for (uint i = bit_no + 1; i <
ALL_BITS; i++)
229 if (
map & (1ULL << i))
return i;
236#elif MAX_INDEXES > 255
237#error "MAX_INDEXES values greater than 255 is not supported."
Definition: sql_bitmap.h:154
char * print(char *buf) const
Definition: sql_bitmap.h:205
Bitmap(uint prefix_to_set)
Definition: sql_bitmap.h:161
bool is_set(uint n) const
Definition: sql_bitmap.h:186
void set_all()
Definition: sql_bitmap.h:179
bool operator==(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:203
Bitmap()
Definition: sql_bitmap.h:158
void init(uint prefix_to_set)
Definition: sql_bitmap.h:163
void intersect(const Bitmap< 64 > &map2)
Definition: sql_bitmap.h:181
void clear_all()
Definition: sql_bitmap.h:180
void set_bit(uint n)
Definition: sql_bitmap.h:165
uint bits_set() const
Definition: sql_bitmap.h:210
ulonglong to_ulonglong() const
Definition: sql_bitmap.h:209
ulonglong map
Definition: sql_bitmap.h:155
bool is_subset(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:199
void intersect(ulonglong map2)
Definition: sql_bitmap.h:182
uint length() const
Definition: sql_bitmap.h:164
void set_prefix(uint n)
Definition: sql_bitmap.h:173
bool is_overlapping(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:200
bool is_clear_all() const
Definition: sql_bitmap.h:197
bool is_set_all() const
Definition: sql_bitmap.h:198
uint get_first_set() const
Definition: sql_bitmap.h:216
void intersect_extended(ulonglong map2)
Definition: sql_bitmap.h:183
bool operator!=(const Bitmap< 64 > &map2) const
Definition: sql_bitmap.h:204
void merge(const Bitmap< 64 > &map2)
Definition: sql_bitmap.h:185
void init()
Definition: sql_bitmap.h:162
void subtract(const Bitmap< 64 > &map2)
Definition: sql_bitmap.h:184
uint get_next_set(uint bit_no) const
Find the next set bit after 'bit_no'.
Definition: sql_bitmap.h:227
bool is_prefix(uint n) const
Definition: sql_bitmap.h:190
void clear_bit(uint n)
Definition: sql_bitmap.h:169
Definition: sql_bitmap.h:43
void intersect(const Bitmap &map2)
Definition: sql_bitmap.h:68
uint get_next_set(uint bit_no) const
Find the next set bit after 'bit_no'.
Definition: sql_bitmap.h:148
char * print(char *buf) const
Definition: sql_bitmap.h:113
@ ALL_BITS
Definition: sql_bitmap.h:48
void set_all()
Definition: sql_bitmap.h:66
Bitmap(uint prefix_to_set)
Definition: sql_bitmap.h:51
void intersect_extended(ulonglong map2buff)
Definition: sql_bitmap.h:91
void set_prefix(uint n)
Definition: sql_bitmap.h:65
void clear_all()
Definition: sql_bitmap.h:67
MY_BITMAP map
Definition: sql_bitmap.h:44
bool is_subset(const Bitmap &map2) const
Definition: sql_bitmap.h:103
void clear_bit(uint n)
Definition: sql_bitmap.h:64
void merge(const Bitmap &map2)
Definition: sql_bitmap.h:98
ulonglong to_ulonglong() const
Definition: sql_bitmap.h:132
bool is_set_all() const
Definition: sql_bitmap.h:102
void subtract(const Bitmap &map2)
Definition: sql_bitmap.h:97
bool is_prefix(uint n) const
Definition: sql_bitmap.h:100
Bitmap & operator=(const Bitmap &map2)
Definition: sql_bitmap.h:58
bool is_clear_all() const
Definition: sql_bitmap.h:101
uint length() const
Definition: sql_bitmap.h:57
uint get_first_set() const
Definition: sql_bitmap.h:141
uint32 buffer[(default_width+31)/32]
Definition: sql_bitmap.h:45
bool operator!=(const Bitmap &map2) const
Definition: sql_bitmap.h:112
void init()
Definition: sql_bitmap.h:52
void init(uint prefix_to_set)
Definition: sql_bitmap.h:53
bool operator==(const Bitmap &map2) const
Definition: sql_bitmap.h:109
void intersect(ulonglong map2buff)
Definition: sql_bitmap.h:69
Bitmap()
Definition: sql_bitmap.h:49
bool is_set(uint n) const
Definition: sql_bitmap.h:99
bool is_overlapping(const Bitmap &map2) const
Definition: sql_bitmap.h:106
void set_bit(uint n)
Definition: sql_bitmap.h:63
uint bits_set() const
Definition: sql_bitmap.h:140
Bitmap(const Bitmap &from)
Definition: sql_bitmap.h:50
static char buf[MAX_BUF]
Definition: conf_to_src.cc:73
constexpr std::array< const char, 37 > dig_vec_upper
Definition: dig_vec.h:34
#define MAX_INDEXES
Definition: config.h:210
static char * longlong2str(int64_t val, char *dst, int radix)
Definition: int2str.h:41
#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
uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit)
Get the next set bit.
Definition: my_bitmap.cc:462
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:180
ulonglong uint8korr(const char *pT)
Definition: my_byteorder.h:164
void int8store(char *pT, ulonglong A)
Definition: my_byteorder.h:192
uint32 uint4korr(const char *pT)
Definition: my_byteorder.h:152
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:235
Definition: my_bitmap.h:43
uint n_bits
Definition: my_bitmap.h:45
int n
Definition: xcom_base.cc:509