Lines Matching refs:nbits
93 unsigned shift, unsigned nbits) in __bitmap_shift_right() argument
95 unsigned k, lim = BITS_TO_LONGS(nbits); in __bitmap_shift_right()
97 unsigned long mask = BITMAP_LAST_WORD_MASK(nbits); in __bitmap_shift_right()
138 unsigned int shift, unsigned int nbits) in __bitmap_shift_left() argument
141 unsigned int lim = BITS_TO_LONGS(nbits); in __bitmap_shift_left()
200 unsigned int first, unsigned int cut, unsigned int nbits) in bitmap_cut() argument
202 unsigned int len = BITS_TO_LONGS(nbits); in bitmap_cut()
285 const unsigned long *mask, unsigned int nbits) in __bitmap_replace() argument
288 unsigned int nr = BITS_TO_LONGS(nbits); in __bitmap_replace()
457 static int bitmap_pos_to_ord(const unsigned long *buf, unsigned int pos, unsigned int nbits) in bitmap_pos_to_ord() argument
459 if (pos >= nbits || !test_bit(pos, buf)) in bitmap_pos_to_ord()
499 unsigned int nbits) in bitmap_remap() argument
505 bitmap_zero(dst, nbits); in bitmap_remap()
507 w = bitmap_weight(new, nbits); in bitmap_remap()
508 for_each_set_bit(oldbit, src, nbits) { in bitmap_remap()
509 int n = bitmap_pos_to_ord(old, oldbit, nbits); in bitmap_remap()
514 set_bit(find_nth_bit(new, nbits, n % w), dst); in bitmap_remap()
704 unsigned int sz, unsigned int nbits) in bitmap_fold() argument
710 bitmap_zero(dst, nbits); in bitmap_fold()
712 for_each_set_bit(oldbit, orig, nbits) in bitmap_fold()
717 unsigned long *bitmap_alloc(unsigned int nbits, gfp_t flags) in bitmap_alloc() argument
719 return kmalloc_array(BITS_TO_LONGS(nbits), sizeof(unsigned long), in bitmap_alloc()
724 unsigned long *bitmap_zalloc(unsigned int nbits, gfp_t flags) in bitmap_zalloc() argument
726 return bitmap_alloc(nbits, flags | __GFP_ZERO); in bitmap_zalloc()
730 unsigned long *bitmap_alloc_node(unsigned int nbits, gfp_t flags, int node) in bitmap_alloc_node() argument
732 return kmalloc_array_node(BITS_TO_LONGS(nbits), sizeof(unsigned long), in bitmap_alloc_node()
737 unsigned long *bitmap_zalloc_node(unsigned int nbits, gfp_t flags, int node) in bitmap_zalloc_node() argument
739 return bitmap_alloc_node(nbits, flags | __GFP_ZERO, node); in bitmap_zalloc_node()
757 unsigned int nbits, gfp_t flags) in devm_bitmap_alloc() argument
762 bitmap = bitmap_alloc(nbits, flags); in devm_bitmap_alloc()
775 unsigned int nbits, gfp_t flags) in devm_bitmap_zalloc() argument
777 return devm_bitmap_alloc(dev, nbits, flags | __GFP_ZERO); in devm_bitmap_zalloc()
788 void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, unsigned int nbits) in bitmap_from_arr32() argument
792 halfwords = DIV_ROUND_UP(nbits, 32); in bitmap_from_arr32()
800 if (nbits % BITS_PER_LONG) in bitmap_from_arr32()
801 bitmap[(halfwords - 1) / 2] &= BITMAP_LAST_WORD_MASK(nbits); in bitmap_from_arr32()
811 void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, unsigned int nbits) in bitmap_to_arr32() argument
815 halfwords = DIV_ROUND_UP(nbits, 32); in bitmap_to_arr32()
823 if (nbits % BITS_PER_LONG) in bitmap_to_arr32()
824 buf[halfwords - 1] &= (u32) (UINT_MAX >> ((-nbits) & 31)); in bitmap_to_arr32()
836 void bitmap_from_arr64(unsigned long *bitmap, const u64 *buf, unsigned int nbits) in bitmap_from_arr64() argument
840 for (n = nbits; n > 0; n -= 64) { in bitmap_from_arr64()
855 if (nbits % BITS_PER_LONG) in bitmap_from_arr64()
856 bitmap[-1] &= BITMAP_LAST_WORD_MASK(nbits); in bitmap_from_arr64()
866 void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits) in bitmap_to_arr64() argument
868 const unsigned long *end = bitmap + BITS_TO_LONGS(nbits); in bitmap_to_arr64()
878 if (nbits % 64) in bitmap_to_arr64()
879 buf[-1] &= GENMASK_ULL((nbits - 1) % 64, 0); in bitmap_to_arr64()