25#ifndef MY_BITMAP_INCLUDED
26#define MY_BITMAP_INCLUDED
32#define MY_BIT_NONE (~(uint)0)
74 uint max_bits_to_copy = UINT_MAX);
76#define bitmap_buffer_size(bits) (((bits) + 31) / 32) * 4
77#define no_bytes_in_map(map) (((map)->n_bits + 7) / 8)
78#define no_words_in_map(map) (((map)->n_bits + 31) / 32)
81 assert(bit < map->n_bits);
82 ((
uchar *)
map->bitmap)[bit / 8] |= (1 << (bit & 7));
86 assert(bit < map->n_bits);
87 ((
uchar *)
map->bitmap)[bit / 8] ^= (1 << (bit & 7));
91 assert(bit < map->n_bits);
92 ((
uchar *)
map->bitmap)[bit / 8] &= ~(1 << (bit & 7));
96 assert(bit < map->n_bits);
97 return ((
uchar *)
map->bitmap)[bit / 8] & (1 << (bit & 7));
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
uint32 my_bitmap_map
Definition: my_bitmap.h:41
bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
Definition: my_bitmap.cc:301
void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:398
uint bitmap_n_copy(MY_BITMAP *dst, const MY_BITMAP *src, uint max_bits_to_copy=UINT_MAX)
Copy as many bits as 'dst' can hold from 'src', but no more than max_bits_to_copy bits.
Definition: my_bitmap.cc:519
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
void bitmap_invert(MY_BITMAP *map)
Definition: my_bitmap.cc:407
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:95
static void bitmap_flip_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:85
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
bool bitmap_is_valid(const MY_BITMAP *map)
Check if 'map' is valid.
Definition: my_bitmap.cc:324
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
bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
Definition: my_bitmap.cc:179
#define no_words_in_map(map)
Definition: my_bitmap.h:78
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
void create_last_word_mask(MY_BITMAP *map)
Definition: my_bitmap.cc:64
bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
Definition: my_bitmap.cc:281
void bitmap_free(MY_BITMAP *map)
Definition: my_bitmap.cc:158
uint bitmap_set_next(MY_BITMAP *map)
Definition: my_bitmap.cc:187
static void bitmap_set_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:80
uint bitmap_get_first(const MY_BITMAP *map)
Definition: my_bitmap.cc:494
void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:430
bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
Definition: my_bitmap.cc:218
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
uint32_t uint32
Definition: my_inttypes.h:67
Definition: buf0block_hint.cc:30
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2894
Definition: my_bitmap.h:43
my_bitmap_map * bitmap
Definition: my_bitmap.h:44
uint n_bits
Definition: my_bitmap.h:45
my_bitmap_map last_word_mask
Definition: my_bitmap.h:46
my_bitmap_map * last_word_ptr
Definition: my_bitmap.h:47