On Wed, Nov 18, 2009 at 10:22, Hennerich, Michael wrote: >From: Mike Frysinger [mailto:[email protected]] >>On Wed, Nov 18, 2009 at 04:52, <[email protected]> wrote: >>> Log Message >>> >>> Fix BFIN_DEPOSIT and BFIN_EXTRACT macros: >>> find first bit in word (__ffs) returns 0 in case the first bit in word >>> is set. >>> >>> Modified: trunk/arch/blackfin/include/asm/def_LPBlackfin.h (7843 => >>7844) >>> >>> -#define BFIN_DEPOSIT(mask, x) (((x) << (__ffs(mask) - 1)) & >>(mask)) >>> -#define BFIN_EXTRACT(mask, x) (((x) & (mask)) >> (__ffs(mask) - >>1)) >>> +#define BFIN_DEPOSIT(mask, x) (((x) << __ffs(mask)) & (mask)) >>> +#define BFIN_EXTRACT(mask, x) (((x) & (mask)) >> __ffs(mask)) >> >>i was going by the documentation: >>/** >> * ffs - find first bit set >> * @x: the word to search >> * >> * This is defined the same way as >> * the libc and compiler builtin ffs routines >> >>and my C library does: >>$ cat test.c >>#include <strings.h> >>#include <stdio.h> >>main(){printf("%i\n", ffs(1));} >>$ gcc test.c && ./a.out >>1 >> >>so if you give a mask of 0x3ff, ffs() should return 1, and you dont >>want to do any shifting. i'll have to double check what the kernel >>does. > > This is what the kernel uses: > asm-geeneric/bitops/__ffs.h
i know, but my understanding of __ffs() is that it should be like ffs(), but not handle a value of 0 properly. ill have to tinker when i get back. -mike _______________________________________________ Linux-kernel-commits mailing list [email protected] https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits
