Lines Matching refs:bm
37 struct bitmap bm; in bm_alloc() local
40 bm.size = size; in bm_alloc()
41 bm.map = malloc(szmap); in bm_alloc()
42 if (bm.map) in bm_alloc()
43 memset(bm.map, 0, szmap); in bm_alloc()
44 return bm; in bm_alloc()
48 bm_dealloc(struct bitmap * bm) in bm_dealloc() argument
50 free(bm->map); in bm_dealloc()
61 bm_setbit(struct bitmap * bm, int pos) in bm_setbit() argument
66 bm->map[pos] |= bmask; in bm_setbit()
70 bm_clrbit(struct bitmap * bm, int pos) in bm_clrbit() argument
75 bm->map[pos] &= ~bmask; in bm_clrbit()
79 bm_isset(struct bitmap * bm, int pos) in bm_isset() argument
84 return !!(bm->map[pos] & bmask); in bm_isset()
88 bm_firstunset(struct bitmap * bm) in bm_firstunset() argument
90 int szmap = (bm->size / 8) + !!(bm->size % 8); in bm_firstunset()
95 unsigned char bmv = bm->map[pos++]; in bm_firstunset()
109 bm_lastset(struct bitmap * bm) in bm_lastset() argument
111 int szmap = (bm->size / 8) + !!(bm->size % 8); in bm_lastset()
117 unsigned char bmv = bm->map[pos++]; in bm_lastset()