From afcd4f6235659c611f0e62236f6a7bc0ae08af1e Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Tue, 16 Dec 2014 11:26:35 -0300 Subject: tools: Adopt fls_long and deps Will be used when adopting rounddown_pow_of_two. Cc: Adrian Hunter Cc: Borislav Petkov Cc: David Ahern Cc: Don Zickus Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-9m0tt5300q1ygv51hejjas82@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/include/asm-generic/bitops.h | 3 +++ tools/include/asm-generic/bitops/__fls.h | 1 + tools/include/asm-generic/bitops/fls.h | 1 + tools/include/asm-generic/bitops/fls64.h | 1 + tools/include/linux/bitops.h | 7 +++++++ 5 files changed, 13 insertions(+) create mode 100644 tools/include/asm-generic/bitops/__fls.h create mode 100644 tools/include/asm-generic/bitops/fls.h create mode 100644 tools/include/asm-generic/bitops/fls64.h (limited to 'tools/include') diff --git a/tools/include/asm-generic/bitops.h b/tools/include/asm-generic/bitops.h index 6dfd9d5fd828..6eedba1f7732 100644 --- a/tools/include/asm-generic/bitops.h +++ b/tools/include/asm-generic/bitops.h @@ -13,6 +13,9 @@ */ #include +#include +#include +#include #include #ifndef _TOOLS_LINUX_BITOPS_H_ diff --git a/tools/include/asm-generic/bitops/__fls.h b/tools/include/asm-generic/bitops/__fls.h new file mode 100644 index 000000000000..2218b9add4c1 --- /dev/null +++ b/tools/include/asm-generic/bitops/__fls.h @@ -0,0 +1 @@ +#include <../../../../include/asm-generic/bitops/__fls.h> diff --git a/tools/include/asm-generic/bitops/fls.h b/tools/include/asm-generic/bitops/fls.h new file mode 100644 index 000000000000..dbf711a28f71 --- /dev/null +++ b/tools/include/asm-generic/bitops/fls.h @@ -0,0 +1 @@ +#include <../../../../include/asm-generic/bitops/fls.h> diff --git a/tools/include/asm-generic/bitops/fls64.h b/tools/include/asm-generic/bitops/fls64.h new file mode 100644 index 000000000000..980b1f63c047 --- /dev/null +++ b/tools/include/asm-generic/bitops/fls64.h @@ -0,0 +1 @@ +#include <../../../../include/asm-generic/bitops/fls64.h> diff --git a/tools/include/linux/bitops.h b/tools/include/linux/bitops.h index 5237bc9f6266..26005a15e7e2 100644 --- a/tools/include/linux/bitops.h +++ b/tools/include/linux/bitops.h @@ -43,4 +43,11 @@ static inline unsigned long hweight_long(unsigned long w) return sizeof(w) == 4 ? hweight32(w) : hweight64(w); } +static inline unsigned fls_long(unsigned long l) +{ + if (sizeof(l) == 4) + return fls(l); + return fls64(l); +} + #endif -- cgit v1.2.3-59-g8ed1b