00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include <drizzled/key_map.h>
00023
00024 namespace drizzled
00025 {
00026
00027 bool is_keymap_prefix(const key_map& map, const uint32_t prefix_size)
00028 {
00029 size_t pos= 0;
00030
00031 for (; pos < prefix_size; pos++)
00032 if (! map.test(pos))
00033 return false;
00034
00035
00036
00037
00038
00039
00040
00041 for (; pos < map.size(); pos++)
00042 if (map.test(pos))
00043 return false;
00044
00045 return true;
00046 }
00047
00048 void set_prefix(key_map& map, const uint32_t prefix_size)
00049 {
00050 size_t pos= 0;
00051
00052 for (; pos < prefix_size && pos < map.size(); pos++)
00053 {
00054 map.set(pos);
00055 }
00056 }
00057
00058 bool is_overlapping(const key_map& map, const key_map& map2)
00059 {
00060 size_t count;
00061 for (count= 0; count < map.size(); count++)
00062 {
00063 if (map[count] & map2[count])
00064 return false;
00065 }
00066 return true;
00067 }
00068
00069 void key_map_subtract(key_map& map1, key_map& map2)
00070 {
00071 map1&= map2.flip();
00072 map2.flip();
00073 }
00074
00075 }