diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-10-17 17:12:33 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-19 09:26:34 +0200 |
commit | 5a116dd2797677cad48fee2f42267e3cb69f5502 (patch) | |
tree | 94bc08d8c234e26c8b8caa156815964e0a56f159 /tools/perf/util/include/linux/bitops.h | |
parent | 11018201b831e19304c0d639f105ad6c27e120b1 (diff) |
perf tools: Use kernel bitmap library
Use the kernel bitmap library for internal perf tools uses.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
LKML-Reference: <1255792354-11304-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/include/linux/bitops.h')
-rw-r--r-- | tools/perf/util/include/linux/bitops.h | 27 |
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 00000000000..ace57c36d1d --- /dev/null +++ b/tools/perf/util/include/linux/bitops.h @@ -0,0 +1,27 @@ +#ifndef _PERF_LINUX_BITOPS_H_ +#define _PERF_LINUX_BITOPS_H_ + +#define __KERNEL__ + +#define CONFIG_GENERIC_FIND_NEXT_BIT +#define CONFIG_GENERIC_FIND_FIRST_BIT +#include "../../../../include/linux/bitops.h" + +static inline void set_bit(int nr, unsigned long *addr) +{ + addr[nr / BITS_PER_LONG] |= 1UL << (nr % BITS_PER_LONG); +} + +static __always_inline int test_bit(unsigned int nr, const unsigned long *addr) +{ + return ((1UL << (nr % BITS_PER_LONG)) & + (((unsigned long *)addr)[nr / BITS_PER_LONG])) != 0; +} + +unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned + long size, unsigned long offset); + +unsigned long generic_find_next_le_bit(const unsigned long *addr, unsigned + long size, unsigned long offset); + +#endif |