GNU Linux-libre 4.14.290-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_zero_bit
20
21 /**
22  * find_next_zero_bit - find the next cleared bit in a memory region
23  * @addr: The 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 of the next zero bit
28  * If no bits are zero, returns @size.
29  */
30 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
31                                  unsigned long offset);
32 #endif
33
34 #ifndef find_first_bit
35
36 /**
37  * find_first_bit - find the first set bit in a memory region
38  * @addr: The address to start the search at
39  * @size: The maximum number of bits to search
40  *
41  * Returns the bit number of the first set bit.
42  * If no bits are set, returns @size.
43  */
44 extern unsigned long find_first_bit(const unsigned long *addr,
45                                     unsigned long size);
46
47 #endif /* find_first_bit */
48
49 #ifndef find_first_zero_bit
50
51 /**
52  * find_first_zero_bit - find the first cleared bit in a memory region
53  * @addr: The address to start the search at
54  * @size: The maximum number of bits to search
55  *
56  * Returns the bit number of the first cleared bit.
57  * If no bits are zero, returns @size.
58  */
59 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size);
60 #endif
61
62 #endif /*_TOOLS_LINUX_ASM_GENERIC_BITOPS_FIND_H_ */