patch-2.4.23 linux-2.4.23/include/asm-ia64/bitops.h

Next file: linux-2.4.23/include/asm-ia64/elf.h
Previous file: linux-2.4.23/include/asm-ia64/acpi.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.22/include/asm-ia64/bitops.h linux-2.4.23/include/asm-ia64/bitops.h
@@ -282,6 +282,21 @@
 	return result;
 }
 
+/**
+ * __ffs - find first bit in word.
+ * @x: The word to search
+ *
+ * Undefined if no bit exists, so code should check against 0 first.
+ */
+static __inline__ unsigned long
+__ffs (unsigned long x)
+{
+	unsigned long result;
+
+	__asm__ ("popcnt %0=%1" : "=r" (result) : "r" ((x - 1) & ~x));
+	return result;
+}
+
 #ifdef __KERNEL__
 
 /*

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)