1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_
3 #define _TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_
5 extern unsigned long _find_next_bit(const unsigned long *addr1,
6 const unsigned long *addr2, unsigned long nbits,
7 unsigned long start, unsigned long invert, unsigned long le);
11 * find_next_bit - find the next set bit in a memory region
12 * @addr: The address to base the search on
13 * @offset: The bitnumber to start searching at
14 * @size: The bitmap size in bits
16 * Returns the bit number for the next set bit
17 * If no bits are set, returns @size.
20 unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
23 return _find_next_bit(addr, NULL, size, offset, 0UL, 0);
27 #ifndef find_next_and_bit
29 * find_next_and_bit - find the next set bit in both memory regions
30 * @addr1: The first address to base the search on
31 * @addr2: The second address to base the search on
32 * @offset: The bitnumber to start searching at
33 * @size: The bitmap size in bits
35 * Returns the bit number for the next set bit
36 * If no bits are set, returns @size.
39 unsigned long find_next_and_bit(const unsigned long *addr1,
40 const unsigned long *addr2, unsigned long size,
43 return _find_next_bit(addr1, addr2, size, offset, 0UL, 0);
47 #ifndef find_next_zero_bit
49 * find_next_zero_bit - find the next cleared bit in a memory region
50 * @addr: The address to base the search on
51 * @offset: The bitnumber to start searching at
52 * @size: The bitmap size in bits
54 * Returns the bit number of the next zero bit
55 * If no bits are zero, returns @size.
58 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
61 return _find_next_bit(addr, NULL, size, offset, ~0UL, 0);
65 #ifndef find_first_bit
68 * find_first_bit - find the first set bit in a memory region
69 * @addr: The address to start the search at
70 * @size: The maximum number of bits to search
72 * Returns the bit number of the first set bit.
73 * If no bits are set, returns @size.
75 extern unsigned long find_first_bit(const unsigned long *addr,
78 #endif /* find_first_bit */
80 #ifndef find_first_zero_bit
83 * find_first_zero_bit - find the first cleared bit in a memory region
84 * @addr: The address to start the search at
85 * @size: The maximum number of bits to search
87 * Returns the bit number of the first cleared bit.
88 * If no bits are zero, returns @size.
90 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size);
93 #endif /*_TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ */