patch-2.2.0-pre6 linux/include/asm-ppc/bitops.h

Next file: linux/include/asm-ppc/dma.h
Previous file: linux/include/asm-mips/termbits.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.0-pre5/linux/include/asm-ppc/bitops.h linux/include/asm-ppc/bitops.h
@@ -1,5 +1,5 @@
 /*
- * $Id: bitops.h,v 1.10 1998/08/16 21:56:53 geert Exp $
+ * $Id: bitops.h,v 1.11 1999/01/03 20:16:48 cort Exp $
  * bitops.h: Bit string operations on the ppc
  */
 
@@ -15,6 +15,16 @@
 extern int test_and_set_bit(int nr, volatile void *addr);
 extern int test_and_clear_bit(int nr, volatile void *addr);
 extern int test_and_change_bit(int nr, volatile void *addr);
+
+
+/* Returns the number of 0's to the left of the most significant 1 bit */
+extern __inline__  int cntlzw(int bits)
+{
+	int lz;
+
+	asm ("cntlzw %0,%1" : "=r" (lz) : "r" (bits));
+	return lz;
+}
 
 /*
  * These are if'd out here because using : "cc" as a constraint

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov