find.h 2.3 KB

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