summaryrefslogtreecommitdiff
path: root/linux/src/include/asm-i386
diff options
context:
space:
mode:
authorThomas Schwinge <tschwinge@gnu.org>2006-06-09 23:50:14 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:37 +0200
commit57c412aeb0f2e475adc33e5c86b2ddfec0453dec (patch)
treea0811153322a5201aa779d2e08b3c09053daa502 /linux/src/include/asm-i386
parent46066cf8d9392a3a9a423f4a7e6c0582a1efcd88 (diff)
2006-06-09 Stefan Siegl <stesie@brokenpipe.de>
* linux/dev/include/asm-i386/uaccess.h: New dummy file. * linux/dev/include/linux/pm.h: Likewise. * linux/dev/include/linux/threads.h: Likewise. * linux/src/include/linux/symtab_begin.h: New file from Linux 2.0.40. * linux/src/include/linux/symtab_end.h: Likewise. * linux/src/include/linux/module.h: Update from Linux 2.0.40 with minor changes. * linux/src/include/linux/list.h: New file from Linux 2.2.26. * linux/src/include/linux/kcomp.h: Likewise with minor changes. * linux/src/include/linux/wait.h: Update from Linux 2.2.26. * linux/src/include/linux/wireless.h: Likewise. * linux/src/include/asm-i386/bitops.h [__KERNEL__] (ffs, hweight32) (hweight16, hweight8): Copy from Linux 2.2.26.
Diffstat (limited to 'linux/src/include/asm-i386')
-rw-r--r--linux/src/include/asm-i386/bitops.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/linux/src/include/asm-i386/bitops.h b/linux/src/include/asm-i386/bitops.h
index e3ea8f5..d3ed1fb 100644
--- a/linux/src/include/asm-i386/bitops.h
+++ b/linux/src/include/asm-i386/bitops.h
@@ -134,4 +134,34 @@ extern __inline__ unsigned long ffz(unsigned long word)
return word;
}
+#ifdef __KERNEL__
+
+/*
+ * ffs: find first bit set. This is defined the same way as
+ * the libc and compiler builtin ffs routines, therefore
+ * differs in spirit from the above ffz (man ffs).
+ */
+
+extern __inline__ int ffs(int x)
+{
+ int r;
+
+ __asm__("bsfl %1,%0\n\t"
+ "jnz 1f\n\t"
+ "movl $-1,%0\n"
+ "1:" : "=r" (r) : "g" (x));
+ return r+1;
+}
+
+/*
+ * hweightN: returns the hamming weight (i.e. the number
+ * of bits set) of a N-bit word
+ */
+
+#define hweight32(x) generic_hweight32(x)
+#define hweight16(x) generic_hweight16(x)
+#define hweight8(x) generic_hweight8(x)
+
+#endif /* __KERNEL__ */
+
#endif /* _I386_BITOPS_H */