Lines Matching full:size
21 extern unsigned long _find_first_bit(const unsigned long *addr, unsigned long size);
22 unsigned long __find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n);
24 unsigned long size, unsigned long n);
26 unsigned long size, unsigned long n);
28 const unsigned long *addr3, unsigned long size,
31 const unsigned long *addr2, unsigned long size);
33 const unsigned long *addr3, unsigned long size);
34 extern unsigned long _find_first_zero_bit(const unsigned long *addr, unsigned long size);
35 extern unsigned long _find_last_bit(const unsigned long *addr, unsigned long size);
38 unsigned long _find_first_zero_bit_le(const unsigned long *addr, unsigned long size);
40 long size, unsigned long offset);
42 long size, unsigned long offset);
49 * @size: The bitmap size in bits
53 * If no bits are set, returns @size.
56 unsigned long find_next_bit(const unsigned long *addr, unsigned long size, in find_next_bit() argument
59 if (small_const_nbits(size)) { in find_next_bit()
62 if (unlikely(offset >= size)) in find_next_bit()
63 return size; in find_next_bit()
65 val = *addr & GENMASK(size - 1, offset); in find_next_bit()
66 return val ? __ffs(val) : size; in find_next_bit()
69 return _find_next_bit(addr, size, offset); in find_next_bit()
78 * @size: The bitmap size in bits
82 * If no bits are set, returns @size.
86 const unsigned long *addr2, unsigned long size, in find_next_and_bit() argument
89 if (small_const_nbits(size)) { in find_next_and_bit()
92 if (unlikely(offset >= size)) in find_next_and_bit()
93 return size; in find_next_and_bit()
95 val = *addr1 & *addr2 & GENMASK(size - 1, offset); in find_next_and_bit()
96 return val ? __ffs(val) : size; in find_next_and_bit()
99 return _find_next_and_bit(addr1, addr2, size, offset); in find_next_and_bit()
109 * @size: The bitmap size in bits
113 * If no bits are set, returns @size.
117 const unsigned long *addr2, unsigned long size, in find_next_andnot_bit() argument
120 if (small_const_nbits(size)) { in find_next_andnot_bit()
123 if (unlikely(offset >= size)) in find_next_andnot_bit()
124 return size; in find_next_andnot_bit()
126 val = *addr1 & ~*addr2 & GENMASK(size - 1, offset); in find_next_andnot_bit()
127 return val ? __ffs(val) : size; in find_next_andnot_bit()
130 return _find_next_andnot_bit(addr1, addr2, size, offset); in find_next_andnot_bit()
139 * @size: The bitmap size in bits
143 * If no bits are set, returns @size.
147 const unsigned long *addr2, unsigned long size, in find_next_or_bit() argument
150 if (small_const_nbits(size)) { in find_next_or_bit()
153 if (unlikely(offset >= size)) in find_next_or_bit()
154 return size; in find_next_or_bit()
156 val = (*addr1 | *addr2) & GENMASK(size - 1, offset); in find_next_or_bit()
157 return val ? __ffs(val) : size; in find_next_or_bit()
160 return _find_next_or_bit(addr1, addr2, size, offset); in find_next_or_bit()
168 * @size: The bitmap size in bits
172 * If no bits are zero, returns @size.
175 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, in find_next_zero_bit() argument
178 if (small_const_nbits(size)) { in find_next_zero_bit()
181 if (unlikely(offset >= size)) in find_next_zero_bit()
182 return size; in find_next_zero_bit()
184 val = *addr | ~GENMASK(size - 1, offset); in find_next_zero_bit()
185 return val == ~0UL ? size : ffz(val); in find_next_zero_bit()
188 return _find_next_zero_bit(addr, size, offset); in find_next_zero_bit()
196 * @size: The maximum number of bits to search
199 * If no bits are set, returns @size.
202 unsigned long find_first_bit(const unsigned long *addr, unsigned long size) in find_first_bit() argument
204 if (small_const_nbits(size)) { in find_first_bit()
205 unsigned long val = *addr & GENMASK(size - 1, 0); in find_first_bit()
207 return val ? __ffs(val) : size; in find_first_bit()
210 return _find_first_bit(addr, size); in find_first_bit()
217 * @size: The maximum number of bits to search
221 * idx = find_nth_bit(addr, size, 0);
222 * idx = find_first_bit(addr, size);
225 * If no such, returns >= @size.
228 unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n) in find_nth_bit() argument
230 if (n >= size) in find_nth_bit()
231 return size; in find_nth_bit()
233 if (small_const_nbits(size)) { in find_nth_bit()
234 unsigned long val = *addr & GENMASK(size - 1, 0); in find_nth_bit()
236 return val ? fns(val, n) : size; in find_nth_bit()
239 return __find_nth_bit(addr, size, n); in find_nth_bit()
246 * @size: The maximum number of bits to search
250 * If no such, returns @size.
254 unsigned long size, unsigned long n) in find_nth_and_bit() argument
256 if (n >= size) in find_nth_and_bit()
257 return size; in find_nth_and_bit()
259 if (small_const_nbits(size)) { in find_nth_and_bit()
260 unsigned long val = *addr1 & *addr2 & GENMASK(size - 1, 0); in find_nth_and_bit()
262 return val ? fns(val, n) : size; in find_nth_and_bit()
265 return __find_nth_and_bit(addr1, addr2, size, n); in find_nth_and_bit()
273 * @size: The maximum number of bits to search
277 * If no such, returns @size.
281 unsigned long size, unsigned long n) in find_nth_andnot_bit() argument
283 if (n >= size) in find_nth_andnot_bit()
284 return size; in find_nth_andnot_bit()
286 if (small_const_nbits(size)) { in find_nth_andnot_bit()
287 unsigned long val = *addr1 & (~*addr2) & GENMASK(size - 1, 0); in find_nth_andnot_bit()
289 return val ? fns(val, n) : size; in find_nth_andnot_bit()
292 return __find_nth_andnot_bit(addr1, addr2, size, n); in find_nth_andnot_bit()
301 * @size: The maximum number of bits to search
305 * If no such, returns @size.
311 unsigned long size, unsigned long n) in find_nth_and_andnot_bit() argument
313 if (n >= size) in find_nth_and_andnot_bit()
314 return size; in find_nth_and_andnot_bit()
316 if (small_const_nbits(size)) { in find_nth_and_andnot_bit()
317 unsigned long val = *addr1 & *addr2 & (~*addr3) & GENMASK(size - 1, 0); in find_nth_and_andnot_bit()
319 return val ? fns(val, n) : size; in find_nth_and_andnot_bit()
322 return __find_nth_and_andnot_bit(addr1, addr2, addr3, size, n); in find_nth_and_andnot_bit()
330 * @size: The bitmap size in bits
333 * If no bits are set, returns @size.
338 unsigned long size) in find_first_and_bit() argument
340 if (small_const_nbits(size)) { in find_first_and_bit()
341 unsigned long val = *addr1 & *addr2 & GENMASK(size - 1, 0); in find_first_and_bit()
343 return val ? __ffs(val) : size; in find_first_and_bit()
346 return _find_first_and_bit(addr1, addr2, size); in find_first_and_bit()
355 * @size: The bitmap size in bits
358 * If no bits are set, returns @size.
364 unsigned long size) in find_first_and_and_bit() argument
366 if (small_const_nbits(size)) { in find_first_and_and_bit()
367 unsigned long val = *addr1 & *addr2 & *addr3 & GENMASK(size - 1, 0); in find_first_and_and_bit()
369 return val ? __ffs(val) : size; in find_first_and_and_bit()
372 return _find_first_and_and_bit(addr1, addr2, addr3, size); in find_first_and_and_bit()
379 * @size: The maximum number of bits to search
382 * If no bits are zero, returns @size.
385 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) in find_first_zero_bit() argument
387 if (small_const_nbits(size)) { in find_first_zero_bit()
388 unsigned long val = *addr | ~GENMASK(size - 1, 0); in find_first_zero_bit()
390 return val == ~0UL ? size : ffz(val); in find_first_zero_bit()
393 return _find_first_zero_bit(addr, size); in find_first_zero_bit()
401 * @size: The number of bits to search
403 * Returns the bit number of the last set bit, or size.
406 unsigned long find_last_bit(const unsigned long *addr, unsigned long size) in find_last_bit() argument
408 if (small_const_nbits(size)) { in find_last_bit()
409 unsigned long val = *addr & GENMASK(size - 1, 0); in find_last_bit()
411 return val ? __fls(val) : size; in find_last_bit()
414 return _find_last_bit(addr, size); in find_last_bit()
422 * @size: The bitmap size in bits
426 * If no bits are set, returns @size.
431 unsigned long size, unsigned long offset) in find_next_and_bit_wrap() argument
433 unsigned long bit = find_next_and_bit(addr1, addr2, size, offset); in find_next_and_bit_wrap()
435 if (bit < size || offset == 0) in find_next_and_bit_wrap()
439 return bit < offset ? bit : size; in find_next_and_bit_wrap()
445 * @size: The bitmap size in bits
449 * If no bits are set, returns @size.
453 unsigned long size, unsigned long offset) in find_next_bit_wrap() argument
455 unsigned long bit = find_next_bit(addr, size, offset); in find_next_bit_wrap()
457 if (bit < size || offset == 0) in find_next_bit_wrap()
461 return bit < offset ? bit : size; in find_next_bit_wrap()
469 unsigned long __for_each_wrap(const unsigned long *bitmap, unsigned long size, in __for_each_wrap() argument
477 bit = find_next_bit(bitmap, size, n); in __for_each_wrap()
478 if (bit < size) in __for_each_wrap()
487 return bit < start ? bit : size; in __for_each_wrap()
494 * @size: bitmap size in number of bits
498 * copied to the location pointed by @clump. If no bits are set, returns @size.
502 unsigned long size, unsigned long offset);
504 #define find_first_clump8(clump, bits, size) \ argument
505 find_next_clump8((clump), (bits), (size), 0)
510 unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset) in find_next_zero_bit_le() argument
512 return find_next_zero_bit(addr, size, offset); in find_next_zero_bit_le()
516 unsigned long find_next_bit_le(const void *addr, unsigned long size, unsigned long offset) in find_next_bit_le() argument
518 return find_next_bit(addr, size, offset); in find_next_bit_le()
522 unsigned long find_first_zero_bit_le(const void *addr, unsigned long size) in find_first_zero_bit_le() argument
524 return find_first_zero_bit(addr, size); in find_first_zero_bit_le()
532 long size, unsigned long offset) in find_next_zero_bit_le() argument
534 if (small_const_nbits(size)) { in find_next_zero_bit_le()
537 if (unlikely(offset >= size)) in find_next_zero_bit_le()
538 return size; in find_next_zero_bit_le()
540 val = swab(val) | ~GENMASK(size - 1, offset); in find_next_zero_bit_le()
541 return val == ~0UL ? size : ffz(val); in find_next_zero_bit_le()
544 return _find_next_zero_bit_le(addr, size, offset); in find_next_zero_bit_le()
550 unsigned long find_first_zero_bit_le(const void *addr, unsigned long size) in find_first_zero_bit_le() argument
552 if (small_const_nbits(size)) { in find_first_zero_bit_le()
553 unsigned long val = swab(*(const unsigned long *)addr) | ~GENMASK(size - 1, 0); in find_first_zero_bit_le()
555 return val == ~0UL ? size : ffz(val); in find_first_zero_bit_le()
558 return _find_first_zero_bit_le(addr, size); in find_first_zero_bit_le()
565 long size, unsigned long offset) in find_next_bit_le() argument
567 if (small_const_nbits(size)) { in find_next_bit_le()
570 if (unlikely(offset >= size)) in find_next_bit_le()
571 return size; in find_next_bit_le()
573 val = swab(val) & GENMASK(size - 1, offset); in find_next_bit_le()
574 return val ? __ffs(val) : size; in find_next_bit_le()
577 return _find_next_bit_le(addr, size, offset); in find_next_bit_le()
585 #define for_each_set_bit(bit, addr, size) \ argument
586 for ((bit) = 0; (bit) = find_next_bit((addr), (size), (bit)), (bit) < (size); (bit)++)
588 #define for_each_and_bit(bit, addr1, addr2, size) \ argument
590 (bit) = find_next_and_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
593 #define for_each_andnot_bit(bit, addr1, addr2, size) \ argument
595 (bit) = find_next_andnot_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
598 #define for_each_or_bit(bit, addr1, addr2, size) \ argument
600 (bit) = find_next_or_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
604 #define for_each_set_bit_from(bit, addr, size) \ argument
605 for (; (bit) = find_next_bit((addr), (size), (bit)), (bit) < (size); (bit)++)
607 #define for_each_clear_bit(bit, addr, size) \ argument
609 (bit) = find_next_zero_bit((addr), (size), (bit)), (bit) < (size); \
613 #define for_each_clear_bit_from(bit, addr, size) \ argument
614 for (; (bit) = find_next_zero_bit((addr), (size), (bit)), (bit) < (size); (bit)++)
621 * @size: bitmap size in number of bits
623 #define for_each_set_bitrange(b, e, addr, size) \ argument
625 (b) = find_next_bit((addr), (size), b), \
626 (e) = find_next_zero_bit((addr), (size), (b) + 1), \
627 (b) < (size); \
635 * @size: bitmap size in number of bits
637 #define for_each_set_bitrange_from(b, e, addr, size) \ argument
639 (b) = find_next_bit((addr), (size), (b)), \
640 (e) = find_next_zero_bit((addr), (size), (b) + 1), \
641 (b) < (size); \
649 * @size: bitmap size in number of bits
651 #define for_each_clear_bitrange(b, e, addr, size) \ argument
653 (b) = find_next_zero_bit((addr), (size), (b)), \
654 (e) = find_next_bit((addr), (size), (b) + 1), \
655 (b) < (size); \
663 * @size: bitmap size in number of bits
665 #define for_each_clear_bitrange_from(b, e, addr, size) \ argument
667 (b) = find_next_zero_bit((addr), (size), (b)), \
668 (e) = find_next_bit((addr), (size), (b) + 1), \
669 (b) < (size); \
677 * @size: bitmap size in number of bits
680 #define for_each_set_bit_wrap(bit, addr, size, start) \ argument
681 for ((bit) = find_next_bit_wrap((addr), (size), (start)); \
682 (bit) < (size); \
683 (bit) = __for_each_wrap((addr), (size), (start), (bit) + 1))
690 * @size: bitmap size in number of bits
692 #define for_each_set_clump8(start, clump, bits, size) \ argument
693 for ((start) = find_first_clump8(&(clump), (bits), (size)); \
694 (start) < (size); \
695 (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8))