Lines Matching refs:b

37 bitset_init(bitset_t *b)  in bitset_init()  argument
39 bzero(b, sizeof (bitset_t)); in bitset_init()
47 bitset_init_fanout(bitset_t *b, uint_t fanout) in bitset_init_fanout() argument
49 bzero(b, sizeof (bitset_t)); in bitset_init_fanout()
50 b->bs_fanout = fanout; in bitset_init_fanout()
58 bitset_fini(bitset_t *b) in bitset_fini() argument
60 if (b->bs_words > 0) in bitset_fini()
61 kmem_free(b->bs_set, b->bs_words * sizeof (ulong_t)); in bitset_fini()
71 bitset_resize(bitset_t *b, uint_t els) in bitset_resize() argument
76 nwords = BT_BITOUL(els << b->bs_fanout); in bitset_resize()
77 if (b->bs_words == nwords) in bitset_resize()
86 if (b->bs_words > 0) in bitset_resize()
87 bcopy(b->bs_set, bset_new, in bitset_resize()
88 MIN(b->bs_words, nwords) * sizeof (ulong_t)); in bitset_resize()
94 bset_tmp = b->bs_set; in bitset_resize()
95 b->bs_set = bset_new; in bitset_resize()
98 if (b->bs_words > 0) in bitset_resize()
99 kmem_free(bset_tmp, b->bs_words * sizeof (ulong_t)); in bitset_resize()
101 b->bs_words = nwords; in bitset_resize()
108 bitset_capacity(bitset_t *b) in bitset_capacity() argument
110 return (b->bs_words * BT_NBIPUL); in bitset_capacity()
123 bitset_add(bitset_t *b, uint_t elt) in bitset_add() argument
125 uint_t pos = (elt << b->bs_fanout); in bitset_add()
127 ASSERT(b->bs_words * BT_NBIPUL > pos); in bitset_add()
128 BT_SET(b->bs_set, pos); in bitset_add()
135 bitset_atomic_add(bitset_t *b, uint_t elt) in bitset_atomic_add() argument
137 uint_t pos = (elt << b->bs_fanout); in bitset_atomic_add()
139 ASSERT(b->bs_words * BT_NBIPUL > pos); in bitset_atomic_add()
140 BT_ATOMIC_SET(b->bs_set, pos); in bitset_atomic_add()
148 bitset_atomic_test_and_add(bitset_t *b, uint_t elt) in bitset_atomic_test_and_add() argument
150 uint_t pos = (elt << b->bs_fanout); in bitset_atomic_test_and_add()
153 ASSERT(b->bs_words * BT_NBIPUL > pos); in bitset_atomic_test_and_add()
154 BT_ATOMIC_SET_EXCL(b->bs_set, pos, ret); in bitset_atomic_test_and_add()
163 bitset_del(bitset_t *b, uint_t elt) in bitset_del() argument
165 uint_t pos = (elt << b->bs_fanout); in bitset_del()
167 ASSERT(b->bs_words * BT_NBIPUL > pos); in bitset_del()
168 BT_CLEAR(b->bs_set, pos); in bitset_del()
175 bitset_atomic_del(bitset_t *b, uint_t elt) in bitset_atomic_del() argument
177 uint_t pos = (elt << b->bs_fanout); in bitset_atomic_del()
179 ASSERT(b->bs_words * BT_NBIPUL > pos); in bitset_atomic_del()
180 BT_ATOMIC_CLEAR(b->bs_set, pos); in bitset_atomic_del()
188 bitset_atomic_test_and_del(bitset_t *b, uint_t elt) in bitset_atomic_test_and_del() argument
190 uint_t pos = (elt << b->bs_fanout); in bitset_atomic_test_and_del()
193 ASSERT(b->bs_words * BT_NBIPUL > pos); in bitset_atomic_test_and_del()
194 BT_ATOMIC_CLEAR_EXCL(b->bs_set, pos, ret); in bitset_atomic_test_and_del()
203 bitset_in_set(bitset_t *b, uint_t elt) in bitset_in_set() argument
205 uint_t pos = (elt << b->bs_fanout); in bitset_in_set()
207 if (pos >= b->bs_words * BT_NBIPUL) in bitset_in_set()
210 return (BT_TEST(b->bs_set, pos)); in bitset_in_set()
217 bitset_is_null(bitset_t *b) in bitset_is_null() argument
221 for (i = 0; i < b->bs_words; i++) in bitset_is_null()
222 if (b->bs_set[i] != 0) in bitset_is_null()
256 bitset_find(bitset_t *b) in bitset_find() argument
264 ASSERT(b->bs_words > 0); in bitset_find()
265 start = seed % b->bs_words; in bitset_find()
269 elt = bitset_find_in_word(b->bs_set[i], seed); in bitset_find()
272 return (elt >> b->bs_fanout); in bitset_find()
274 if (++i == b->bs_words) in bitset_find()
351 bitset_zero(bitset_t *b) in bitset_zero() argument
353 bzero(b->bs_set, sizeof (ulong_t) * b->bs_words); in bitset_zero()