24#ifndef MY_BITMAP_INCLUDED
25#define MY_BITMAP_INCLUDED
31#define MY_BIT_NONE (~(uint)0)
73 uint max_bits_to_copy = UINT_MAX);
75#define bitmap_buffer_size(bits) (((bits) + 31) / 32) * 4
76#define no_bytes_in_map(map) (((map)->n_bits + 7) / 8)
77#define no_words_in_map(map) (((map)->n_bits + 31) / 32)
80 assert(bit < map->n_bits);
81 ((
uchar *)
map->bitmap)[bit / 8] |= (1 << (bit & 7));
85 assert(bit < map->n_bits);
86 ((
uchar *)
map->bitmap)[bit / 8] ^= (1 << (bit & 7));
90 assert(bit < map->n_bits);
91 ((
uchar *)
map->bitmap)[bit / 8] &= ~(1 << (bit & 7));
95 assert(bit < map->n_bits);
96 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:107
uint32 my_bitmap_map
Definition: my_bitmap.h:40
bool bitmap_is_overlapping(const MY_BITMAP *map1, const MY_BITMAP *map2)
Definition: my_bitmap.cc:300
void bitmap_xor(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:397
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:518
static void bitmap_set_all(MY_BITMAP *map)
Definition: my_bitmap.h:127
bool bitmap_is_clear_all(const MY_BITMAP *map)
Definition: my_bitmap.cc:267
void bitmap_invert(MY_BITMAP *map)
Definition: my_bitmap.cc:406
static bool bitmap_is_set(const MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:94
static void bitmap_flip_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:84
bool bitmap_is_set_all(const MY_BITMAP *map)
Definition: my_bitmap.cc:256
static void bitmap_clear_all(MY_BITMAP *map)
Definition: my_bitmap.h:120
void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:379
uint bitmap_bits_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:415
void bitmap_intersect(MY_BITMAP *to, const MY_BITMAP *from)
Definition: my_bitmap.cc:334
uint bitmap_get_next_set(const MY_BITMAP *map, uint bitmap_bit)
Get the next set bit.
Definition: my_bitmap.cc:461
void bitmap_set_above(MY_BITMAP *map, uint from_byte, bool use_bit)
Definition: my_bitmap.cc:371
bool bitmap_is_valid(const MY_BITMAP *map)
Check if 'map' is valid.
Definition: my_bitmap.cc:323
uint bitmap_get_first_set(const MY_BITMAP *map)
Definition: my_bitmap.cc:438
bool bitmap_init(MY_BITMAP *map, my_bitmap_map *buf, uint n_bits)
Definition: my_bitmap.cc:139
void bitmap_union(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:388
static void bitmap_clear_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:89
bool bitmap_test_and_set(MY_BITMAP *map, uint bitmap_bit)
Definition: my_bitmap.cc:178
#define no_words_in_map(map)
Definition: my_bitmap.h:77
void bitmap_set_prefix(MY_BITMAP *map, uint prefix_size)
Set the specified number of bits in the bitmap buffer.
Definition: my_bitmap.cc:200
void create_last_word_mask(MY_BITMAP *map)
Definition: my_bitmap.cc:63
bool bitmap_is_subset(const MY_BITMAP *map1, const MY_BITMAP *map2)
Definition: my_bitmap.cc:280
void bitmap_free(MY_BITMAP *map)
Definition: my_bitmap.cc:157
uint bitmap_set_next(MY_BITMAP *map)
Definition: my_bitmap.cc:186
static void bitmap_set_bit(MY_BITMAP *map, uint bit)
Definition: my_bitmap.h:79
uint bitmap_get_first(const MY_BITMAP *map)
Definition: my_bitmap.cc:493
void bitmap_copy(MY_BITMAP *map, const MY_BITMAP *map2)
Definition: my_bitmap.cc:429
bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size)
Definition: my_bitmap.cc:217
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:51
uint32_t uint32
Definition: my_inttypes.h:66
Definition: buf0block_hint.cc:29
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2890
Definition: my_bitmap.h:42
my_bitmap_map * bitmap
Definition: my_bitmap.h:43
uint n_bits
Definition: my_bitmap.h:44
my_bitmap_map last_word_mask
Definition: my_bitmap.h:45
my_bitmap_map * last_word_ptr
Definition: my_bitmap.h:46
unsigned int uint
Definition: uca-dump.cc:29