Lines Matching full:bitmap

3  * lib/bitmap.c
4 * Helper functions for bitmap.h.
7 #include <linux/bitmap.h>
15 * DOC: bitmap introduction
19 * given bitmap does _not_ need to be an exact multiple of
23 * of a bitmap are 'don't care'. The implementation makes
26 * The bitmap operations that return Boolean (bitmap_empty,
82 * __bitmap_shift_right - logical right shift of the bits in a bitmap
83 * @dst : destination bitmap
84 * @src : source bitmap
86 * @nbits : bitmap size, in bits
126 * __bitmap_shift_left - logical left shift of the bits in a bitmap
127 * @dst : destination bitmap
128 * @src : source bitmap
130 * @nbits : bitmap size, in bits
163 * bitmap_cut() - remove bit region from bitmap and right shift remaining bits
164 * @dst: destination bitmap, might overlap with src
165 * @src: source bitmap
168 * @nbits: bitmap size, in bits
176 * The @src bitmap is::
338 unsigned int __bitmap_weight(const unsigned long *bitmap, unsigned int bits) in __bitmap_weight() argument
340 return BITMAP_WEIGHT(bitmap[idx], bits); in __bitmap_weight()
396 * @size: The bitmap size in bits
433 * bitmap_pos_to_ord - find ordinal of set bit at given position in bitmap
434 * @buf: pointer to a bitmap
459 * bitmap_remap - Apply map defined by a pair of bitmaps to another bitmap
552 * bitmap_onto - translate one bitmap relative to another
553 * @dst: resulting translated bitmap
554 * @orig: original untranslated bitmap
555 * @relmap: bitmap relative to which translated
574 * @orig bitmap over itself so that all its set bits x are in the
617 * unsigned long *tmp; // a temporary bitmap's bits
625 * using bitmap_fold() to fold the @orig bitmap modulo ten
686 * bitmap_fold - fold larger bitmap into smaller, modulo specified size
687 * @dst: resulting smaller bitmap
688 * @orig: original larger bitmap
736 void bitmap_free(const unsigned long *bitmap) in bitmap_free() argument
738 kfree(bitmap); in bitmap_free()
744 unsigned long *bitmap = data; in devm_bitmap_free() local
746 bitmap_free(bitmap); in devm_bitmap_free()
752 unsigned long *bitmap; in devm_bitmap_alloc() local
755 bitmap = bitmap_alloc(nbits, flags); in devm_bitmap_alloc()
756 if (!bitmap) in devm_bitmap_alloc()
759 ret = devm_add_action_or_reset(dev, devm_bitmap_free, bitmap); in devm_bitmap_alloc()
763 return bitmap; in devm_bitmap_alloc()
776 * bitmap_from_arr32 - copy the contents of u32 array of bits to bitmap
777 * @bitmap: array of unsigned longs, the destination bitmap
778 * @buf: array of u32 (in host byte order), the source bitmap
779 * @nbits: number of bits in @bitmap
781 void bitmap_from_arr32(unsigned long *bitmap, const u32 *buf, unsigned int nbits) in bitmap_from_arr32() argument
787 bitmap[i/2] = (unsigned long) buf[i]; in bitmap_from_arr32()
789 bitmap[i/2] |= ((unsigned long) buf[i]) << 32; in bitmap_from_arr32()
794 bitmap[(halfwords - 1) / 2] &= BITMAP_LAST_WORD_MASK(nbits); in bitmap_from_arr32()
799 * bitmap_to_arr32 - copy the contents of bitmap to a u32 array of bits
800 * @buf: array of u32 (in host byte order), the dest bitmap
801 * @bitmap: array of unsigned longs, the source bitmap
802 * @nbits: number of bits in @bitmap
804 void bitmap_to_arr32(u32 *buf, const unsigned long *bitmap, unsigned int nbits) in bitmap_to_arr32() argument
810 buf[i] = (u32) (bitmap[i/2] & UINT_MAX); in bitmap_to_arr32()
812 buf[i] = (u32) (bitmap[i/2] >> 32); in bitmap_to_arr32()
824 * bitmap_from_arr64 - copy the contents of u64 array of bits to bitmap
825 * @bitmap: array of unsigned longs, the destination bitmap
826 * @buf: array of u64 (in host byte order), the source bitmap
827 * @nbits: number of bits in @bitmap
829 void bitmap_from_arr64(unsigned long *bitmap, const u64 *buf, unsigned int nbits) in bitmap_from_arr64() argument
836 *bitmap++ = val; in bitmap_from_arr64()
838 *bitmap++ = val >> 32; in bitmap_from_arr64()
845 * to the last word of the bitmap, except for nbits == 0, which in bitmap_from_arr64()
849 bitmap[-1] &= BITMAP_LAST_WORD_MASK(nbits); in bitmap_from_arr64()
854 * bitmap_to_arr64 - copy the contents of bitmap to a u64 array of bits
855 * @buf: array of u64 (in host byte order), the dest bitmap
856 * @bitmap: array of unsigned longs, the source bitmap
857 * @nbits: number of bits in @bitmap
859 void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits) in bitmap_to_arr64() argument
861 const unsigned long *end = bitmap + BITS_TO_LONGS(nbits); in bitmap_to_arr64()
863 while (bitmap < end) { in bitmap_to_arr64()
864 *buf = *bitmap++; in bitmap_to_arr64()
865 if (bitmap < end) in bitmap_to_arr64()
866 *buf |= (u64)(*bitmap++) << 32; in bitmap_to_arr64()