Lines Matching defs:map
35 * Clears a bit in the bit map.
38 void gb_clear(struct gb_t_map *map, u32 bitn)
43 map->words[bitn / BITS_PER_LONG] &= ~mask;
49 * Creates a bit map.
54 struct gb_t_map *map;
56 map = (struct gb_t_map *)gs_alloc(sizeof(struct gb_t_map));
57 if (map != NULL) {
58 map->len = len;
59 map->wcnt = len / BITS_PER_LONG + 1;
60 map->words = (u32 *) gs_alloc(map->wcnt * sizeof(u32));
61 if (map->words != NULL) {
62 for (i = 0; i < map->wcnt; i++)
63 map->words[i] = 0L;
66 gs_frees(map, sizeof(struct gb_t_map));
67 map = NULL;
71 return map;
77 * Frees a bit map.
80 void gb_delete(struct gb_t_map *map)
82 gs_frees(map->words, map->wcnt * sizeof(u32));
83 gs_frees(map, sizeof(struct gb_t_map));
91 u32 gb_findandset(struct gb_t_map *map)
95 bitn = gb_minclear(map);
98 gb_set(map, bitn);
106 * returns the location of the first unset bit in the bit map.
108 u32 gb_minclear(struct gb_t_map *map)
116 for (word = map->words, i = 0; i < map->wcnt; word++, i++) {
119 if (bit_acc == map->len)
139 * Sets a bit in the bit map.
142 void gb_set(struct gb_t_map *map, u32 bitn)
147 map->words[bitn / BITS_PER_LONG] |= mask;
156 bool gb_test(struct gb_t_map *map, u32 bitn)
163 word = map->words[bitn / BITS_PER_LONG];