/tools/perf/util/include/linux/bitops.h

https://bitbucket.org/abioy/linux · C Header · 29 lines · 21 code · 8 blank · 0 comment · 1 complexity · 361c20bf736f5e1be449d6e07700ea53 MD5 · raw file

  1. #ifndef _PERF_LINUX_BITOPS_H_
  2. #define _PERF_LINUX_BITOPS_H_
  3. #define __KERNEL__
  4. #define CONFIG_GENERIC_FIND_NEXT_BIT
  5. #define CONFIG_GENERIC_FIND_FIRST_BIT
  6. #include "../../../../include/linux/bitops.h"
  7. #undef __KERNEL__
  8. static inline void set_bit(int nr, unsigned long *addr)
  9. {
  10. addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
  11. }
  12. static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
  13. {
  14. return ((1UL << (nr % BITS_PER_LONG)) &
  15. (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
  16. }
  17. unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
  18. long size, unsigned long offset);
  19. unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
  20. long size, unsigned long offset);
  21. #endif