Lines Matching refs:nbits
42 * bitmap_zero(bitmap, nbits)
44 * Zero a bitmap that was allocated to have nbits bits. Yes, this
45 * zeros bits past nbits.
48 bitmap_zero(unsigned long *bitmap, size_t nbits)
51 size_t n = howmany(nbits, bpl);
57 * bitmap_empty(bitmap, nbits)
59 * Return true if all bits at 0, 1, 2, ..., nbits-2, nbits-1 are
63 bitmap_empty(const unsigned long *bitmap, size_t nbits)
67 for (; nbits >= bpl; nbits -= bpl) {
72 if (nbits) {
73 if (*bitmap & ~(~0UL << nbits))
81 * bitmap_weight(bitmap, nbits)
83 * Compute the number of 1 bits at 0, 1, 2, ..., nbits-2, nbits-1.
86 bitmap_weight(const unsigned long *bitmap, size_t nbits)
91 for (; nbits >= bpl; nbits -= bpl)
93 if (nbits)
94 weight += popcountl(*bitmap & ~(~0UL << nbits));
100 * bitmap_set(bitmap, startbit, nbits)
102 * Set bits at startbit, startbit+1, ..., startbit+nbits-2,
103 * startbit+nbits-1 to 1.
106 bitmap_set(unsigned long *bitmap, size_t startbit, size_t nbits)
115 if (nbits <= bpl - initial) {
116 /* Yes: just set nbits starting at initial. */
117 *p |= ~(~0ULL << nbits) << initial;
122 nbits -= bpl - initial;
126 for (; nbits >= bpl; nbits -= bpl)
129 /* Handle a final odd word if any by setting its low nbits. */
130 if (nbits)
131 *p |= ~(~0ULL << nbits);
135 * bitmap_clear(bitmap, startbit, nbits)
137 * Clear bits at startbit, startbit+1, ..., startbit+nbits-2,
138 * startbit+nbits-1, replacing them by 0.
141 bitmap_clear(unsigned long *bitmap, size_t startbit, size_t nbits)
150 if (nbits <= bpl - initial) {
151 /* Yes: just clear nbits starting at initial. */
152 *p &= ~(~(~0ULL << nbits) << initial);
157 nbits -= bpl - initial;
161 for (; nbits >= bpl; nbits -= bpl)
164 /* Handle a final odd word if any by clearing its low nbits. */
165 if (nbits)
166 *p &= ~0ULL << nbits;
170 * bitmap_copy(dst, src, nbits)
176 bitmap_copy(unsigned long *dst, const unsigned long *src, size_t nbits)
179 size_t n = howmany(nbits, bpl);
186 * bitmap_complement(dst, src, nbits)
191 bitmap_complement(unsigned long *dst, const unsigned long *src, size_t nbits)
194 size_t n = howmany(nbits, bpl);
201 * bitmap_and(dst, src1, src2, nbits)
204 * allocated to have nbits bits. Yes, this modifies bits past
205 * nbits. Any pair of {dst, src1, src2} may be aliases.
209 const unsigned long *src2, size_t nbits)
212 size_t n = howmany(nbits, bpl);
219 * bitmap_andnot(dst, src1, src2, nbits)
222 * allocated to have nbits bits. Yes, this modifies bits past
223 * nbits. Any pair of {dst, src1, src2} may be aliases.
227 const unsigned long *src2, size_t nbits)
230 size_t n = howmany(nbits, bpl);
237 * bitmap_or(dst, src1, src2, nbits)
240 * bitmaps allocated to have nbits bits. Yes, this modifies bits
241 * past nbits. Any pair of {dst, src1, src2} may be aliases.
245 const unsigned long *src2, size_t nbits)
248 size_t n = howmany(nbits, bpl);
255 bitmap_zalloc(size_t nbits, gfp_t gfp)
258 size_t n = howmany(nbits, bpl);