diff options
author | Ingo Molnar <mingo@kernel.org> | 2016-07-19 06:44:38 (GMT) |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-19 06:44:38 (GMT) |
commit | 5048c2af078d5976895d521262a8802ea791f3b0 (patch) | |
tree | ff17370ff5f36680ca7f71df0b9444747699348c /tools/include/asm-generic/bitops/fls64.h | |
parent | 09211e2530ab4905ec16edecc27022d6b247419d (diff) | |
parent | 988dd774dcbd9151c2a643fc7284c5c3c4d0adb7 (diff) | |
download | linux-5048c2af078d5976895d521262a8802ea791f3b0.tar.xz |
Merge tag 'perf-core-for-mingo-20160718' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Properly report when a function wildcard produces no matches in 'perf probe'
(Masami Hiramatsu)
- Balance opening and reading events in 'perf stat', which could cause
it to get stuck trying to close invalid file descriptors (Mark Rutland)
Infrastructure changes:
- Copy more headers from the kernel, this time for headers that
were just including the contents of its kernel counterparts, should
help resolving the problems with linux-next, where some uapi related
patches seem to be breaking tools/object/ build. (Arnaldo Carvalho de Melo)
Some more combing will be done, but at least it is possible to build
perf out of tree, via a detached tarball (make help | grep perf),
without including kernel files in its MANIFEST (Arnaldo Carvalho de Melo)
- Fix smatch found errors that were not causing problems, but are
mistakes nonetheless (Dan Carpenter)
- Fix string vs. byte array resolving in the python script code (Jiri Olsa)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/include/asm-generic/bitops/fls64.h')
-rw-r--r-- | tools/include/asm-generic/bitops/fls64.h | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/tools/include/asm-generic/bitops/fls64.h b/tools/include/asm-generic/bitops/fls64.h index 35bee00..b097cf8 100644 --- a/tools/include/asm-generic/bitops/fls64.h +++ b/tools/include/asm-generic/bitops/fls64.h @@ -1 +1,36 @@ -#include "../../../../include/asm-generic/bitops/fls64.h" +#ifndef _ASM_GENERIC_BITOPS_FLS64_H_ +#define _ASM_GENERIC_BITOPS_FLS64_H_ + +#include <asm/types.h> + +/** + * fls64 - find last set bit in a 64-bit word + * @x: the word to search + * + * This is defined in a similar way as the libc and compiler builtin + * ffsll, but returns the position of the most significant set bit. + * + * fls64(value) returns 0 if value is 0 or the position of the last + * set bit if value is nonzero. The last (most significant) bit is + * at position 64. + */ +#if BITS_PER_LONG == 32 +static __always_inline int fls64(__u64 x) +{ + __u32 h = x >> 32; + if (h) + return fls(h) + 32; + return fls(x); +} +#elif BITS_PER_LONG == 64 +static __always_inline int fls64(__u64 x) +{ + if (x == 0) + return 0; + return __fls(x) + 1; +} +#else +#error BITS_PER_LONG not 32 or 64 +#endif + +#endif /* _ASM_GENERIC_BITOPS_FLS64_H_ */ |