Lines Matching refs:size

19 extern unsigned long _find_first_bit(const unsigned long *addr, unsigned long size);
20 unsigned long __find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n);
22 unsigned long size, unsigned long n);
24 unsigned long size, unsigned long n);
26 const unsigned long *addr2, unsigned long size);
27 extern unsigned long _find_first_zero_bit(const unsigned long *addr, unsigned long size);
28 extern unsigned long _find_last_bit(const unsigned long *addr, unsigned long size);
31 unsigned long _find_first_zero_bit_le(const unsigned long *addr, unsigned long size);
33 long size, unsigned long offset);
35 long size, unsigned long offset);
49 unsigned long find_next_bit(const unsigned long *addr, unsigned long size, in find_next_bit() argument
52 if (small_const_nbits(size)) { in find_next_bit()
55 if (unlikely(offset >= size)) in find_next_bit()
56 return size; in find_next_bit()
58 val = *addr & GENMASK(size - 1, offset); in find_next_bit()
59 return val ? __ffs(val) : size; in find_next_bit()
62 return _find_next_bit(addr, size, offset); in find_next_bit()
79 const unsigned long *addr2, unsigned long size, in find_next_and_bit() argument
82 if (small_const_nbits(size)) { in find_next_and_bit()
85 if (unlikely(offset >= size)) in find_next_and_bit()
86 return size; in find_next_and_bit()
88 val = *addr1 & *addr2 & GENMASK(size - 1, offset); in find_next_and_bit()
89 return val ? __ffs(val) : size; in find_next_and_bit()
92 return _find_next_and_bit(addr1, addr2, size, offset); in find_next_and_bit()
110 const unsigned long *addr2, unsigned long size, in find_next_andnot_bit() argument
113 if (small_const_nbits(size)) { in find_next_andnot_bit()
116 if (unlikely(offset >= size)) in find_next_andnot_bit()
117 return size; in find_next_andnot_bit()
119 val = *addr1 & ~*addr2 & GENMASK(size - 1, offset); in find_next_andnot_bit()
120 return val ? __ffs(val) : size; in find_next_andnot_bit()
123 return _find_next_andnot_bit(addr1, addr2, size, offset); in find_next_andnot_bit()
138 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, in find_next_zero_bit() argument
141 if (small_const_nbits(size)) { in find_next_zero_bit()
144 if (unlikely(offset >= size)) in find_next_zero_bit()
145 return size; in find_next_zero_bit()
147 val = *addr | ~GENMASK(size - 1, offset); in find_next_zero_bit()
148 return val == ~0UL ? size : ffz(val); in find_next_zero_bit()
151 return _find_next_zero_bit(addr, size, offset); in find_next_zero_bit()
165 unsigned long find_first_bit(const unsigned long *addr, unsigned long size) in find_first_bit() argument
167 if (small_const_nbits(size)) { in find_first_bit()
168 unsigned long val = *addr & GENMASK(size - 1, 0); in find_first_bit()
170 return val ? __ffs(val) : size; in find_first_bit()
173 return _find_first_bit(addr, size); in find_first_bit()
191 unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n) in find_nth_bit() argument
193 if (n >= size) in find_nth_bit()
194 return size; in find_nth_bit()
196 if (small_const_nbits(size)) { in find_nth_bit()
197 unsigned long val = *addr & GENMASK(size - 1, 0); in find_nth_bit()
199 return val ? fns(val, n) : size; in find_nth_bit()
202 return __find_nth_bit(addr, size, n); in find_nth_bit()
217 unsigned long size, unsigned long n) in find_nth_and_bit() argument
219 if (n >= size) in find_nth_and_bit()
220 return size; in find_nth_and_bit()
222 if (small_const_nbits(size)) { in find_nth_and_bit()
223 unsigned long val = *addr1 & *addr2 & GENMASK(size - 1, 0); in find_nth_and_bit()
225 return val ? fns(val, n) : size; in find_nth_and_bit()
228 return __find_nth_and_bit(addr1, addr2, size, n); in find_nth_and_bit()
244 unsigned long size, unsigned long n) in find_nth_andnot_bit() argument
246 if (n >= size) in find_nth_andnot_bit()
247 return size; in find_nth_andnot_bit()
249 if (small_const_nbits(size)) { in find_nth_andnot_bit()
250 unsigned long val = *addr1 & (~*addr2) & GENMASK(size - 1, 0); in find_nth_andnot_bit()
252 return val ? fns(val, n) : size; in find_nth_andnot_bit()
255 return __find_nth_andnot_bit(addr1, addr2, size, n); in find_nth_andnot_bit()
271 unsigned long size) in find_first_and_bit() argument
273 if (small_const_nbits(size)) { in find_first_and_bit()
274 unsigned long val = *addr1 & *addr2 & GENMASK(size - 1, 0); in find_first_and_bit()
276 return val ? __ffs(val) : size; in find_first_and_bit()
279 return _find_first_and_bit(addr1, addr2, size); in find_first_and_bit()
293 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) in find_first_zero_bit() argument
295 if (small_const_nbits(size)) { in find_first_zero_bit()
296 unsigned long val = *addr | ~GENMASK(size - 1, 0); in find_first_zero_bit()
298 return val == ~0UL ? size : ffz(val); in find_first_zero_bit()
301 return _find_first_zero_bit(addr, size); in find_first_zero_bit()
314 unsigned long find_last_bit(const unsigned long *addr, unsigned long size) in find_last_bit() argument
316 if (small_const_nbits(size)) { in find_last_bit()
317 unsigned long val = *addr & GENMASK(size - 1, 0); in find_last_bit()
319 return val ? __fls(val) : size; in find_last_bit()
322 return _find_last_bit(addr, size); in find_last_bit()
339 unsigned long size, unsigned long offset) in find_next_and_bit_wrap() argument
341 unsigned long bit = find_next_and_bit(addr1, addr2, size, offset); in find_next_and_bit_wrap()
343 if (bit < size) in find_next_and_bit_wrap()
347 return bit < offset ? bit : size; in find_next_and_bit_wrap()
361 unsigned long size, unsigned long offset) in find_next_bit_wrap() argument
363 unsigned long bit = find_next_bit(addr, size, offset); in find_next_bit_wrap()
365 if (bit < size) in find_next_bit_wrap()
369 return bit < offset ? bit : size; in find_next_bit_wrap()
377 unsigned long __for_each_wrap(const unsigned long *bitmap, unsigned long size, in __for_each_wrap() argument
385 bit = find_next_bit(bitmap, size, n); in __for_each_wrap()
386 if (bit < size) in __for_each_wrap()
395 return bit < start ? bit : size; in __for_each_wrap()
410 unsigned long size, unsigned long offset);
412 #define find_first_clump8(clump, bits, size) \ argument
413 find_next_clump8((clump), (bits), (size), 0)
418 unsigned long size, unsigned long offset) in find_next_zero_bit_le() argument
420 return find_next_zero_bit(addr, size, offset); in find_next_zero_bit_le()
424 unsigned long size, unsigned long offset) in find_next_bit_le() argument
426 return find_next_bit(addr, size, offset); in find_next_bit_le()
430 unsigned long size) in find_first_zero_bit_le() argument
432 return find_first_zero_bit(addr, size); in find_first_zero_bit_le()
440 long size, unsigned long offset) in find_next_zero_bit_le() argument
442 if (small_const_nbits(size)) { in find_next_zero_bit_le()
445 if (unlikely(offset >= size)) in find_next_zero_bit_le()
446 return size; in find_next_zero_bit_le()
448 val = swab(val) | ~GENMASK(size - 1, offset); in find_next_zero_bit_le()
449 return val == ~0UL ? size : ffz(val); in find_next_zero_bit_le()
452 return _find_next_zero_bit_le(addr, size, offset); in find_next_zero_bit_le()
458 unsigned long find_first_zero_bit_le(const void *addr, unsigned long size) in find_first_zero_bit_le() argument
460 if (small_const_nbits(size)) { in find_first_zero_bit_le()
461 unsigned long val = swab(*(const unsigned long *)addr) | ~GENMASK(size - 1, 0); in find_first_zero_bit_le()
463 return val == ~0UL ? size : ffz(val); in find_first_zero_bit_le()
466 return _find_first_zero_bit_le(addr, size); in find_first_zero_bit_le()
473 long size, unsigned long offset) in find_next_bit_le() argument
475 if (small_const_nbits(size)) { in find_next_bit_le()
478 if (unlikely(offset >= size)) in find_next_bit_le()
479 return size; in find_next_bit_le()
481 val = swab(val) & GENMASK(size - 1, offset); in find_next_bit_le()
482 return val ? __ffs(val) : size; in find_next_bit_le()
485 return _find_next_bit_le(addr, size, offset); in find_next_bit_le()
493 #define for_each_set_bit(bit, addr, size) \ argument
494 for ((bit) = 0; (bit) = find_next_bit((addr), (size), (bit)), (bit) < (size); (bit)++)
496 #define for_each_and_bit(bit, addr1, addr2, size) \ argument
498 (bit) = find_next_and_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
501 #define for_each_andnot_bit(bit, addr1, addr2, size) \ argument
503 (bit) = find_next_andnot_bit((addr1), (addr2), (size), (bit)), (bit) < (size);\
507 #define for_each_set_bit_from(bit, addr, size) \ argument
508 for (; (bit) = find_next_bit((addr), (size), (bit)), (bit) < (size); (bit)++)
510 #define for_each_clear_bit(bit, addr, size) \ argument
512 (bit) = find_next_zero_bit((addr), (size), (bit)), (bit) < (size); \
516 #define for_each_clear_bit_from(bit, addr, size) \ argument
517 for (; (bit) = find_next_zero_bit((addr), (size), (bit)), (bit) < (size); (bit)++)
526 #define for_each_set_bitrange(b, e, addr, size) \ argument
528 (b) = find_next_bit((addr), (size), b), \
529 (e) = find_next_zero_bit((addr), (size), (b) + 1), \
530 (b) < (size); \
540 #define for_each_set_bitrange_from(b, e, addr, size) \ argument
542 (b) = find_next_bit((addr), (size), (b)), \
543 (e) = find_next_zero_bit((addr), (size), (b) + 1), \
544 (b) < (size); \
554 #define for_each_clear_bitrange(b, e, addr, size) \ argument
556 (b) = find_next_zero_bit((addr), (size), (b)), \
557 (e) = find_next_bit((addr), (size), (b) + 1), \
558 (b) < (size); \
568 #define for_each_clear_bitrange_from(b, e, addr, size) \ argument
570 (b) = find_next_zero_bit((addr), (size), (b)), \
571 (e) = find_next_bit((addr), (size), (b) + 1), \
572 (b) < (size); \
583 #define for_each_set_bit_wrap(bit, addr, size, start) \ argument
584 for ((bit) = find_next_bit_wrap((addr), (size), (start)); \
585 (bit) < (size); \
586 (bit) = __for_each_wrap((addr), (size), (start), (bit) + 1))
595 #define for_each_set_clump8(start, clump, bits, size) \ argument
596 for ((start) = find_first_clump8(&(clump), (bits), (size)); \
597 (start) < (size); \
598 (start) = find_next_clump8(&(clump), (bits), (size), (start) + 8))