summaryrefslogtreecommitdiff
path: root/tools/include/asm-generic/bitops/__ffz.h
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2016-10-10 10:26:33 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-10-24 17:07:33 +0300
commit02bc11de567273da8ab25c54336ddbb71986f38f (patch)
tree2356fcbb1ad8571a14e61ca58575a752c3de6c2c /tools/include/asm-generic/bitops/__ffz.h
parentfe316723a8106c7527710ae7085a1dc6a9c1ab05 (diff)
downloadlinux-02bc11de567273da8ab25c54336ddbb71986f38f.tar.xz
tools lib: Add for_each_clear_bit macro
Adding for_each_clear_bit macro plus all its the necessary backbone functions. Taken from related kernel code. It will be used in following patch. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-cayv2zbqi0nlmg5sjjxs1775@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include/asm-generic/bitops/__ffz.h')
-rw-r--r--tools/include/asm-generic/bitops/__ffz.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/include/asm-generic/bitops/__ffz.h b/tools/include/asm-generic/bitops/__ffz.h
new file mode 100644
index 000000000000..6744bd4cdf46
--- /dev/null
+++ b/tools/include/asm-generic/bitops/__ffz.h
@@ -0,0 +1,12 @@
+#ifndef _ASM_GENERIC_BITOPS_FFZ_H_
+#define _ASM_GENERIC_BITOPS_FFZ_H_
+
+/*
+ * ffz - find first zero in word.
+ * @word: The word to search
+ *
+ * Undefined if no zero exists, so code should check against ~0UL first.
+ */
+#define ffz(x) __ffs(~(x))
+
+#endif /* _ASM_GENERIC_BITOPS_FFZ_H_ */