From 40c2ce10a7cd034b20d475f0998c4956ae0e179c Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 30 Oct 2003 21:04:09 +0100 Subject: post-merge fixes --- mysys/my_bitmap.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'mysys/my_bitmap.c') diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c index ba4bbde4e3e..336bf27d559 100644 --- a/mysys/my_bitmap.c +++ b/mysys/my_bitmap.c @@ -26,6 +26,8 @@ must be within bitmap size * bitmap_set_prefix() is an exception - one can use ~0 to set all bits * when both arguments are bitmaps, they must be of the same size + * bitmap_intersect() is an exception :) + (for for Bitmap::intersect(ulonglong map2buff)) TODO: Make assembler THREAD safe versions of these using test-and-set instructions @@ -244,17 +246,24 @@ my_bool bitmap_cmp(const MY_BITMAP *map1, const MY_BITMAP *map2) void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2) { uchar *to=map->bitmap, *from=map2->bitmap, *end; + uint len=map->bitmap_size, len2=map2->bitmap; - DBUG_ASSERT(map->bitmap && map2->bitmap && - map->bitmap_size==map2->bitmap_size); + DBUG_ASSERT(map->bitmap && map2->bitmap); bitmap_lock(map); bitmap_lock(map2); - end= to+map->bitmap_size; + end= to+min(len,len2); while (to < end) *to++ &= *from++; + if (len2 < len) + { + end+=len-len2; + while (to < end) + *to++=0; + } + bitmap_unlock(map2); bitmap_unlock(map); } -- cgit v1.2.1