|
@@ -1,5 +1,5 @@
|
|
|
-#ifndef _PERF_LINUX_BITOPS_H_
|
|
|
-#define _PERF_LINUX_BITOPS_H_
|
|
|
+#ifndef _TOOLS_LINUX_BITOPS_H_
|
|
|
+#define _TOOLS_LINUX_BITOPS_H_
|
|
|
|
|
|
#include <linux/kernel.h>
|
|
|
#include <linux/compiler.h>
|
|
@@ -19,6 +19,14 @@
|
|
|
#define BITS_TO_U32(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(u32))
|
|
|
#define BITS_TO_BYTES(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE)
|
|
|
|
|
|
+/*
|
|
|
+ * Include this here because some architectures need generic_ffs/fls in
|
|
|
+ * scope
|
|
|
+ *
|
|
|
+ * XXX: this needs to be asm/bitops.h, when we get to per arch optimizations
|
|
|
+ */
|
|
|
+#include <asm-generic/bitops.h>
|
|
|
+
|
|
|
#define for_each_set_bit(bit, addr, size) \
|
|
|
for ((bit) = find_first_bit((addr), (size)); \
|
|
|
(bit) < (size); \
|
|
@@ -30,14 +38,9 @@
|
|
|
(bit) < (size); \
|
|
|
(bit) = find_next_bit((addr), (size), (bit) + 1))
|
|
|
|
|
|
-#include <asm-generic/bitops/atomic.h>
|
|
|
-
|
|
|
static inline unsigned long hweight_long(unsigned long w)
|
|
|
{
|
|
|
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
|
|
|
}
|
|
|
|
|
|
-#include <asm-generic/bitops/__ffs.h>
|
|
|
-#include <asm-generic/bitops/find.h>
|
|
|
-
|
|
|
#endif
|