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