Lines Matching refs:nbits
124 unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags);
125 unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags);
130 unsigned int nbits, gfp_t flags);
132 unsigned int nbits, gfp_t flags);
139 const unsigned long *bitmap2, unsigned int nbits);
143 unsigned int nbits);
145 unsigned int nbits);
147 unsigned int shift, unsigned int nbits);
149 unsigned int shift, unsigned int nbits);
151 unsigned int first, unsigned int cut, unsigned int nbits);
153 const unsigned long *bitmap2, unsigned int nbits);
155 const unsigned long *bitmap2, unsigned int nbits);
157 const unsigned long *bitmap2, unsigned int nbits);
159 const unsigned long *bitmap2, unsigned int nbits);
162 const unsigned long *mask, unsigned int nbits);
164 const unsigned long *bitmap2, unsigned int nbits);
166 const unsigned long *bitmap2, unsigned int nbits);
167 int __bitmap_weight(const unsigned long *bitmap, unsigned int nbits);
202 unsigned long *dst, int nbits);
204 unsigned long *dst, int nbits);
208 unsigned long *dst, int nbits);
210 const unsigned long *old, const unsigned long *new, unsigned int nbits);
216 unsigned int sz, unsigned int nbits);
222 void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits);
226 unsigned int bitmap_ord_to_pos(const unsigned long *bitmap, unsigned int ord, unsigned int nbits);
237 #define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1))) argument
239 static inline void bitmap_zero(unsigned long *dst, unsigned int nbits) in bitmap_zero() argument
241 unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); in bitmap_zero()
245 static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) in bitmap_fill() argument
247 unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); in bitmap_fill()
252 unsigned int nbits) in bitmap_copy() argument
254 unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); in bitmap_copy()
262 const unsigned long *src, unsigned int nbits) in bitmap_copy_clear_tail() argument
264 bitmap_copy(dst, src, nbits); in bitmap_copy_clear_tail()
265 if (nbits % BITS_PER_LONG) in bitmap_copy_clear_tail()
266 dst[nbits / BITS_PER_LONG] &= BITMAP_LAST_WORD_MASK(nbits); in bitmap_copy_clear_tail()
275 unsigned int nbits);
277 unsigned int nbits);
279 #define bitmap_from_arr32(bitmap, buf, nbits) \ argument
281 (const unsigned long *) (buf), (nbits))
282 #define bitmap_to_arr32(buf, bitmap, nbits) \ argument
284 (const unsigned long *) (bitmap), (nbits))
288 const unsigned long *src2, unsigned int nbits) in bitmap_and() argument
290 if (small_const_nbits(nbits)) in bitmap_and()
291 return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0; in bitmap_and()
292 return __bitmap_and(dst, src1, src2, nbits); in bitmap_and()
296 const unsigned long *src2, unsigned int nbits) in bitmap_or() argument
298 if (small_const_nbits(nbits)) in bitmap_or()
301 __bitmap_or(dst, src1, src2, nbits); in bitmap_or()
305 const unsigned long *src2, unsigned int nbits) in bitmap_xor() argument
307 if (small_const_nbits(nbits)) in bitmap_xor()
310 __bitmap_xor(dst, src1, src2, nbits); in bitmap_xor()
314 const unsigned long *src2, unsigned int nbits) in bitmap_andnot() argument
316 if (small_const_nbits(nbits)) in bitmap_andnot()
317 return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; in bitmap_andnot()
318 return __bitmap_andnot(dst, src1, src2, nbits); in bitmap_andnot()
322 unsigned int nbits) in bitmap_complement() argument
324 if (small_const_nbits(nbits)) in bitmap_complement()
327 __bitmap_complement(dst, src, nbits); in bitmap_complement()
338 const unsigned long *src2, unsigned int nbits) in bitmap_equal() argument
340 if (small_const_nbits(nbits)) in bitmap_equal()
341 return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); in bitmap_equal()
342 if (__builtin_constant_p(nbits & BITMAP_MEM_MASK) && in bitmap_equal()
343 IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT)) in bitmap_equal()
344 return !memcmp(src1, src2, nbits / 8); in bitmap_equal()
345 return __bitmap_equal(src1, src2, nbits); in bitmap_equal()
360 unsigned int nbits) in bitmap_or_equal() argument
362 if (!small_const_nbits(nbits)) in bitmap_or_equal()
363 return __bitmap_or_equal(src1, src2, src3, nbits); in bitmap_or_equal()
365 return !(((*src1 | *src2) ^ *src3) & BITMAP_LAST_WORD_MASK(nbits)); in bitmap_or_equal()
369 const unsigned long *src2, unsigned int nbits) in bitmap_intersects() argument
371 if (small_const_nbits(nbits)) in bitmap_intersects()
372 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; in bitmap_intersects()
374 return __bitmap_intersects(src1, src2, nbits); in bitmap_intersects()
378 const unsigned long *src2, unsigned int nbits) in bitmap_subset() argument
380 if (small_const_nbits(nbits)) in bitmap_subset()
381 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); in bitmap_subset()
383 return __bitmap_subset(src1, src2, nbits); in bitmap_subset()
386 static inline bool bitmap_empty(const unsigned long *src, unsigned nbits) in bitmap_empty() argument
388 if (small_const_nbits(nbits)) in bitmap_empty()
389 return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); in bitmap_empty()
391 return find_first_bit(src, nbits) == nbits; in bitmap_empty()
394 static inline bool bitmap_full(const unsigned long *src, unsigned int nbits) in bitmap_full() argument
396 if (small_const_nbits(nbits)) in bitmap_full()
397 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); in bitmap_full()
399 return find_first_zero_bit(src, nbits) == nbits; in bitmap_full()
402 static __always_inline int bitmap_weight(const unsigned long *src, unsigned int nbits) in bitmap_weight() argument
404 if (small_const_nbits(nbits)) in bitmap_weight()
405 return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); in bitmap_weight()
406 return __bitmap_weight(src, nbits); in bitmap_weight()
410 unsigned int nbits) in bitmap_set() argument
412 if (__builtin_constant_p(nbits) && nbits == 1) in bitmap_set()
416 __builtin_constant_p(nbits & BITMAP_MEM_MASK) && in bitmap_set()
417 IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT)) in bitmap_set()
418 memset((char *)map + start / 8, 0xff, nbits / 8); in bitmap_set()
420 __bitmap_set(map, start, nbits); in bitmap_set()
424 unsigned int nbits) in bitmap_clear() argument
426 if (__builtin_constant_p(nbits) && nbits == 1) in bitmap_clear()
430 __builtin_constant_p(nbits & BITMAP_MEM_MASK) && in bitmap_clear()
431 IS_ALIGNED(nbits, BITMAP_MEM_ALIGNMENT)) in bitmap_clear()
432 memset((char *)map + start / 8, 0, nbits / 8); in bitmap_clear()
434 __bitmap_clear(map, start, nbits); in bitmap_clear()
438 unsigned int shift, unsigned int nbits) in bitmap_shift_right() argument
440 if (small_const_nbits(nbits)) in bitmap_shift_right()
441 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> shift; in bitmap_shift_right()
443 __bitmap_shift_right(dst, src, shift, nbits); in bitmap_shift_right()
447 unsigned int shift, unsigned int nbits) in bitmap_shift_left() argument
449 if (small_const_nbits(nbits)) in bitmap_shift_left()
450 *dst = (*src << shift) & BITMAP_LAST_WORD_MASK(nbits); in bitmap_shift_left()
452 __bitmap_shift_left(dst, src, shift, nbits); in bitmap_shift_left()
459 unsigned int nbits) in bitmap_replace() argument
461 if (small_const_nbits(nbits)) in bitmap_replace()
464 __bitmap_replace(dst, old, new, mask, nbits); in bitmap_replace()