aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/include/linux/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/include/linux/bitops.h')
-rw-r--r--tools/perf/util/include/linux/bitops.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/perf/util/include/linux/bitops.h b/tools/perf/util/include/linux/bitops.h
new file mode 100644
index 000000000000..ace57c36d1d0
--- /dev/null
+++ b/tools/perf/util/include/linux/bitops.h
@@ -0,0 +1,27 @@
1#ifndef _PERF_LINUX_BITOPS_H_
2#define _PERF_LINUX_BITOPS_H_
3
4#define __KERNEL__
5
6#define CONFIG_GENERIC_FIND_NEXT_BIT
7#define CONFIG_GENERIC_FIND_FIRST_BIT
8#include "../../../../include/linux/bitops.h"
9
10static inline void set_bit(int nr, unsigned long *addr)
11{
12 addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG);
13}
14
15static __always_inline int test_bit(unsigned int nr, const unsigned long *addr)
16{
17 return ((1UL << (nr % BITS_PER_LONG)) &
18 (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0;
19}
20
21unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
22 long size, unsigned long offset);
23
24unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned
25 long size, unsigned long offset);
26
27#endif