Lines Matching refs:nbits

97  *   @nbits : bitmap size, in bits
104 unsigned shift, unsigned nbits)
106 unsigned k, lim = BITS_TO_LONGS(nbits);
108 unsigned long mask = BITMAP_LAST_WORD_MASK(nbits);
141 * @nbits : bitmap size, in bits
149 unsigned int shift, unsigned int nbits)
152 unsigned int lim = BITS_TO_LONGS(nbits);
179 * @nbits: bitmap size, in bits
183 * m such that @first <= n < nbits, and m = n + @cut.
211 unsigned int first, unsigned int cut, unsigned int nbits)
213 unsigned int len = BITS_TO_LONGS(nbits);
296 const unsigned long *mask, unsigned int nbits)
299 unsigned int nr = BITS_TO_LONGS(nbits);
598 * - Time complexity is O(nbits^2/count), comparing to O(nbits) for snprintf().
599 * - Memory complexity is O(nbits), comparing to O(1) for snprintf().
643 * start off group_len end nbits
650 unsigned int nbits;
666 if (r->end >= r->nbits)
730 unsigned int lastbit = r->nbits - 1;
812 r.nbits = nmaskbits;
813 bitmap_zero(maskp, r.nbits);
948 * @pos: a bit position in @buf (0 <= @pos < @nbits)
949 * @nbits: number of valid bit positions in @buf
951 * Map the bit at position @pos in @buf (of length @nbits) to the
963 static int bitmap_pos_to_ord(const unsigned long *buf, unsigned int pos, unsigned int nbits)
965 if (pos >= nbits || !test_bit(pos, buf))
977 * @nbits: number of bits in each of these bitmaps
1005 unsigned int nbits)
1011 bitmap_zero(dst, nbits);
1013 w = bitmap_weight(new, nbits);
1014 for_each_set_bit(oldbit, src, nbits) {
1015 int n = bitmap_pos_to_ord(old, oldbit, nbits);
1020 set_bit(find_nth_bit(new, nbits, n % w), dst);
1203 * @nbits: number of bits in each of these bitmaps
1210 unsigned int sz, unsigned int nbits)
1216 bitmap_zero(dst, nbits);
1218 for_each_set_bit(oldbit, orig, nbits)
1367 * @nbits: number of bits in the bitmap
1369 * Require nbits % BITS_PER_LONG == 0.
1372 void bitmap_copy_le(unsigned long *dst, const unsigned long *src, unsigned int nbits)
1376 for (i = 0; i < nbits/BITS_PER_LONG; i++) {
1386 unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags)
1388 return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long),
1393 unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags)
1395 return bitmap_alloc(nbits, flags | __GFP_ZERO);
1399 unsigned long *bitmap_alloc_node(unsigned int nbits, gfp_t flags, int node)
1401 return kmalloc_array_node(BITS_TO_LONGS(nbits), sizeof(unsigned long),
1406 unsigned long *bitmap_zalloc_node(unsigned int nbits, gfp_t flags, int node)
1408 return bitmap_alloc_node(nbits, flags | __GFP_ZERO, node);
1426 unsigned int nbits, gfp_t flags)
1431 bitmap = bitmap_alloc(nbits, flags);
1444 unsigned int nbits, gfp_t flags)
1446 return devm_bitmap_alloc(dev, nbits, flags | __GFP_ZERO);
1455 * @nbits: number of bits in @bitmap
1457 void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, unsigned int nbits)
1461 halfwords = DIV_ROUND_UP(nbits, 32);
1468 /* Clear tail bits in last word beyond nbits. */
1469 if (nbits % BITS_PER_LONG)
1470 bitmap[(halfwords - 1) / 2] &= BITMAP_LAST_WORD_MASK(nbits);
1478 * @nbits: number of bits in @bitmap
1480 void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, unsigned int nbits)
1484 halfwords = DIV_ROUND_UP(nbits, 32);
1491 /* Clear tail bits in last element of array beyond nbits. */
1492 if (nbits % BITS_PER_LONG)
1493 buf[halfwords - 1] &= (u32) (UINT_MAX >> ((-nbits) & 31));
1503 * @nbits: number of bits in @bitmap
1505 void bitmap_from_arr64(unsigned long *bitmap, const u64 *buf, unsigned int nbits)
1509 for (n = nbits; n > 0; n -= 64) {
1518 * Clear tail bits in the last word beyond nbits.
1521 * to the last word of the bitmap, except for nbits == 0, which
1524 if (nbits % BITS_PER_LONG)
1525 bitmap[-1] &= BITMAP_LAST_WORD_MASK(nbits);
1533 * @nbits: number of bits in @bitmap
1535 void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits)
1537 const unsigned long *end = bitmap + BITS_TO_LONGS(nbits);
1546 /* Clear tail bits in the last element of array beyond nbits. */
1547 if (nbits % 64)
1548 buf[-1] &= GENMASK_ULL((nbits - 1) % 64, 0);