1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

bitmap bug fixes and interface change

This commit is contained in:
unknown
2005-06-02 18:40:25 +02:00
parent a46f4cf497
commit 15ca553ab4
5 changed files with 112 additions and 74 deletions

View File

@ -24,7 +24,7 @@
typedef struct st_bitmap
{
uchar *bitmap;
uint32 *bitmap;
uint bitmap_size; /* number of bits occupied by the above */
uint32 last_word_mask;
uint32 *last_word_ptr;
@ -41,7 +41,7 @@ typedef struct st_bitmap
#ifdef __cplusplus
extern "C" {
#endif
extern my_bool bitmap_init(MY_BITMAP *map, uchar *buf, uint bitmap_size, my_bool thread_safe);
extern my_bool bitmap_init(MY_BITMAP *map, uint32 *buf, uint bitmap_size, my_bool thread_safe);
extern my_bool bitmap_is_clear_all(const MY_BITMAP *map);
extern my_bool bitmap_is_prefix(const MY_BITMAP *map, uint prefix_size);
extern my_bool bitmap_is_set_all(const MY_BITMAP *map);
@ -84,10 +84,10 @@ extern void bitmap_lock_invert(MY_BITMAP *map);
#define no_bytes_in_map(map) ((map->bitmap_size + 7)/8)
#define no_words_in_map(map) ((map->bitmap_size + 31)/32)
#define bytes_word_aligned(bytes) (4*((bytes + 3)/4))
#define bitmap_set_bit(MAP, BIT) ((MAP)->bitmap[(BIT) / 8] |= (1 << ((BIT) & 7)))
#define bitmap_flip_bit(MAP, BIT) ((MAP)->bitmap[(BIT) / 8] ^= (1 << ((BIT) & 7)))
#define bitmap_clear_bit(MAP, BIT) ((MAP)->bitmap[(BIT) / 8] &= ~ (1 << ((BIT) & 7)))
#define bitmap_is_set(MAP, BIT) ((MAP)->bitmap[(BIT) / 8] & (1 << ((BIT) & 7)))
#define bitmap_set_bit(MAP, BIT) ((MAP)->bitmap[(BIT) / 32] |= (1 << ((BIT) & 31)))
#define bitmap_flip_bit(MAP, BIT) ((MAP)->bitmap[(BIT) / 32] ^= (1 << ((BIT) & 31)))
#define bitmap_clear_bit(MAP, BIT) ((MAP)->bitmap[(BIT) / 32] &= ~ (1 << ((BIT) & 31)))
#define bitmap_is_set(MAP, BIT) ((MAP)->bitmap[(BIT) / 32] & (1 << ((BIT) & 31)))
#define bitmap_cmp(MAP1, MAP2) \
(memcmp((MAP1)->bitmap, (MAP2)->bitmap, 4*no_words_in_map((MAP1)))==0)
#define bitmap_clear_all(MAP) \