summaryrefslogtreecommitdiff
path: root/include/asm-generic/bitops/builtin-__ffs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic/bitops/builtin-__ffs.h')
-rw-r--r--include/asm-generic/bitops/builtin-__ffs.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/asm-generic/bitops/builtin-__ffs.h b/include/asm-generic/bitops/builtin-__ffs.h
new file mode 100644
index 000000000..90041e3a4
--- /dev/null
+++ b/include/asm-generic/bitops/builtin-__ffs.h
@@ -0,0 +1,15 @@
+#ifndef _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
+#define _ASM_GENERIC_BITOPS_BUILTIN___FFS_H_
+
+/**
+ * __ffs - find first bit in word.
+ * @word: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static __always_inline unsigned long __ffs(unsigned long word)
+{
+ return __builtin_ctzl(word);
+}
+
+#endif