GNU Linux-libre 4.19.286-gnu1
[releases.git] / tools / include / asm-generic / bitops / find.h
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_
4
5 #ifndef find_next_bit
6 /**
7  * find_next_bit - find the next set bit in a memory region
8  * @addr: The address to base the search on
9  * @offset: The bitnumber to start searching at
10  * @size: The bitmap size in bits
11  *
12  * Returns the bit number for the next set bit
13  * If no bits are set, returns @size.
14  */
15 extern unsigned long find_next_bit(const unsigned long *addr, unsigned long
16                 size, unsigned long offset);
17 #endif
18
19 #ifndef find_next_and_bit
20 /**
21  * find_next_and_bit - find the next set bit in both memory regions
22  * @addr1: The first address to base the search on
23  * @addr2: The second address to base the search on
24  * @offset: The bitnumber to start searching at
25  * @size: The bitmap size in bits
26  *
27  * Returns the bit number for the next set bit
28  * If no bits are set, returns @size.
29  */
30 extern unsigned long find_next_and_bit(const unsigned long *addr1,
31                 const unsigned long *addr2, unsigned long size,
32                 unsigned long offset);
33 #endif
34
35 #ifndef find_next_zero_bit
36
37 /**
38  * find_next_zero_bit - find the next cleared bit in a memory region
39  * @addr: The address to base the search on
40  * @offset: The bitnumber to start searching at
41  * @size: The bitmap size in bits
42  *
43  * Returns the bit number of the next zero bit
44  * If no bits are zero, returns @size.
45  */
46 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
47                                  unsigned long offset);
48 #endif
49
50 #ifndef find_first_bit
51
52 /**
53  * find_first_bit - find the first set bit in a memory region
54  * @addr: The address to start the search at
55  * @size: The maximum number of bits to search
56  *
57  * Returns the bit number of the first set bit.
58  * If no bits are set, returns @size.
59  */
60 extern unsigned long find_first_bit(const unsigned long *addr,
61                                     unsigned long size);
62
63 #endif /* find_first_bit */
64
65 #ifndef find_first_zero_bit
66
67 /**
68  * find_first_zero_bit - find the first cleared bit in a memory region
69  * @addr: The address to start the search at
70  * @size: The maximum number of bits to search
71  *
72  * Returns the bit number of the first cleared bit.
73  * If no bits are zero, returns @size.
74  */
75 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size);
76 #endif
77
78 #endif /*_TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ */