Lines Matching full:bits
13 struct arena_bitmap __arena *bmp_alloc(size_t bits) in bmp_alloc() argument
16 size_t size = BITS_TO_LONG_LONGS(bits) * sizeof(bmp->bits[0]); in bmp_alloc()
19 if (bits % BITS_PER_LONG_LONG) in bmp_alloc()
26 bmp_clear(bits, bmp); in bmp_alloc()
40 bmp->bits[BIT_WORD(bit)] |= BIT_MASK(bit); in __bmp_set_bit()
46 bmp->bits[BIT_WORD(bit)] &= ~BIT_MASK(bit); in __bmp_clear_bit()
52 return bmp->bits[BIT_WORD(bit)] & BIT_MASK(bit); in bmp_test_bit()
63 old = bmp->bits[idx]; in bmp_test_and_clear_bit()
69 actual = cmpxchg(&bmp->bits[idx], old, new); in bmp_test_and_clear_bit()
87 old = bmp->bits[idx]; in bmp_test_and_set_bit()
93 actual = cmpxchg(&bmp->bits[idx], old, new); in bmp_test_and_set_bit()
111 old = bmp->bits[idx]; in bmp_clear_bit()
113 actual = cmpxchg(&bmp->bits[idx], old, new); in bmp_clear_bit()
126 old = bmp->bits[idx]; in bmp_set_bit()
128 actual = cmpxchg(&bmp->bits[idx], old, new); in bmp_set_bit()
134 void bmp_clear(size_t bits, struct arena_bitmap __arena *bmp) in bmp_clear() argument
136 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_clear()
140 bmp->bits[i] = 0; in bmp_clear()
143 static __always_inline u64 bmp_last_word_mask(size_t bits) in bmp_last_word_mask() argument
145 u32 rem = bits % BITS_PER_LONG_LONG; in bmp_last_word_mask()
151 void bmp_and(size_t bits, struct arena_bitmap __arena *dst, struct arena_bitmap __arena *src1, stru… in bmp_and() argument
153 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_and()
157 dst->bits[i] = src1->bits[i] & src2->bits[i]; in bmp_and()
159 if (nwords && bits % BITS_PER_LONG_LONG) in bmp_and()
160 dst->bits[nwords - 1] &= bmp_last_word_mask(bits); in bmp_and()
164 void bmp_or(size_t bits, struct arena_bitmap __arena *dst, struct arena_bitmap __arena *src1, struc… in bmp_or() argument
166 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_or()
170 dst->bits[i] = src1->bits[i] | src2->bits[i]; in bmp_or()
172 if (nwords && bits % BITS_PER_LONG_LONG) in bmp_or()
173 dst->bits[nwords - 1] &= bmp_last_word_mask(bits); in bmp_or()
177 bool bmp_empty(size_t bits, struct arena_bitmap __arena *bmp) in bmp_empty() argument
179 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_empty()
183 u64 mask = (i == nwords - 1) ? bmp_last_word_mask(bits) : ~0ULL; in bmp_empty()
185 if (bmp->bits[i] & mask) in bmp_empty()
193 void bmp_copy(size_t bits, struct arena_bitmap __arena *dst, struct arena_bitmap __arena *src) in bmp_copy() argument
195 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_copy()
199 dst->bits[i] = src->bits[i]; in bmp_copy()
201 if (nwords && bits % BITS_PER_LONG_LONG) in bmp_copy()
202 dst->bits[nwords - 1] &= bmp_last_word_mask(bits); in bmp_copy()
206 bool bmp_subset(size_t bits, struct arena_bitmap __arena *big, struct arena_bitmap __arena *small) in bmp_subset() argument
208 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_subset()
212 u64 mask = (i == nwords - 1) ? bmp_last_word_mask(bits) : ~0ULL; in bmp_subset()
214 if (~big->bits[i] & small->bits[i] & mask) in bmp_subset()
222 bool bmp_intersects(size_t bits, struct arena_bitmap __arena *arg1, struct arena_bitmap __arena *ar… in bmp_intersects() argument
224 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_intersects()
228 u64 mask = (i == nwords - 1) ? bmp_last_word_mask(bits) : ~0ULL; in bmp_intersects()
230 if (arg1->bits[i] & arg2->bits[i] & mask) in bmp_intersects()
238 void bmp_print(size_t bits, struct arena_bitmap __arena *bmp) in bmp_print() argument
240 size_t nwords = BITS_TO_LONG_LONGS(bits); in bmp_print()
244 arena_stderr("%016llx ", bmp->bits[i]); in bmp_print()