summaryrefslogtreecommitdiff
path: root/mysys/my_bitmap.c
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2003-10-30 21:04:09 +0100
committerunknown <serg@serg.mylan>2003-10-30 21:04:09 +0100
commite9f308f0b91adb560c75f5d7e333c07949154e7d (patch)
tree71985cb46beaca481825e0486af8af974ff34027 /mysys/my_bitmap.c
parentd054ce1c5d21f981e73e67da29d418ddddc835a3 (diff)
downloadmariadb-git-e9f308f0b91adb560c75f5d7e333c07949154e7d.tar.gz
post-merge fixes
Diffstat (limited to 'mysys/my_bitmap.c')
-rw-r--r--mysys/my_bitmap.c15
1 files changed, 12 insertions, 3 deletions
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);
}