summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2005-07-19 09:15:22 -0700
committerunknown <jimw@mysql.com>2005-07-19 09:15:22 -0700
commit6ae060305541019882bcb60bf086458b010faa45 (patch)
tree91161658401493ebad97db85872bd9ccb764fca4 /mysys
parent1e3be5e98ab82c9ab57e7b6e2ea67d4c2e38f88e (diff)
parentf1d5c0489b03d924750ae7112ffaf34da5d6fe7b (diff)
downloadmariadb-git-6ae060305541019882bcb60bf086458b010faa45.tar.gz
Merge mysql.com:/home/jimw/my/mysql-5.0-readline
into mysql.com:/home/jimw/my/mysql-5.0-clean
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_bitmap.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/mysys/my_bitmap.c b/mysys/my_bitmap.c
index c70c0fa0754..4a917fc8287 100644
--- a/mysys/my_bitmap.c
+++ b/mysys/my_bitmap.c
@@ -339,6 +339,37 @@ void bitmap_intersect(MY_BITMAP *map, const MY_BITMAP *map2)
}
+/*
+ Set/clear all bits above a bit.
+
+ SYNOPSIS
+ bitmap_set_above()
+ map RETURN The bitmap to change.
+ from_byte The bitmap buffer byte offset to start with.
+ use_bit The bit value (1/0) to use for all upper bits.
+
+ NOTE
+ You can only set/clear full bytes.
+ The function is meant for the situation that you copy a smaller bitmap
+ to a bigger bitmap. Bitmap lengths are always multiple of eigth (the
+ size of a byte). Using 'from_byte' saves multiplication and division
+ by eight during parameter passing.
+
+ RETURN
+ void
+*/
+
+void bitmap_set_above(MY_BITMAP *map, uint from_byte, uint use_bit)
+{
+ uchar use_byte= use_bit ? 0xff : 0;
+ uchar *to= map->bitmap + from_byte;
+ uchar *end= map->bitmap + map->bitmap_size;
+
+ while (to < end)
+ *to++= use_byte;
+}
+
+
void bitmap_subtract(MY_BITMAP *map, const MY_BITMAP *map2)
{
uchar *to=map->bitmap, *from=map2->bitmap, *end;