From 57c412aeb0f2e475adc33e5c86b2ddfec0453dec Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 9 Jun 2006 23:50:14 +0000 Subject: 2006-06-09 Stefan Siegl * 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. --- linux/src/include/asm-i386/bitops.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'linux/src/include/asm-i386/bitops.h') diff --git a/linux/src/include/asm-i386/bitops.h b/linux/src/include/asm-i386/bitops.h index e3ea8f54..d3ed1fb9 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 */ -- cgit v1.2.3