On Wed, Jan 13, 2010 at 20:39, David Howells <dhowells@xxxxxxxxxx> wrote: > diff --git a/include/asm-generic/bitops/fls64.h b/include/asm-generic/bitops/fls64.h > index b097cf8..f81e04c 100644 > --- a/include/asm-generic/bitops/fls64.h > +++ b/include/asm-generic/bitops/fls64.h > @@ -18,16 +18,25 @@ > static __always_inline int fls64(__u64 x) > { > __u32 h = x >> 32; > - if (h) > - return fls(h) + 32; > - return fls(x); > + int bitpos = -1; > + > + asm("bsrl %1,%0 \n" > + "subl %2,%0 \n" > + "bsrl %3,%0 \n" > + : "+r" (bitpos) > + : "rm" (x), "i"(32), "rm" (h)); > + > + return bitpos + 33; > } > #elif BITS_PER_LONG == 64 > static __always_inline int fls64(__u64 x) > { > - if (x == 0) > - return 0; > - return __fls(x) + 1; > + long bitpos = -1; > + > + asm("bsrq %1,%0" > + : "+r" (bitpos) > + : "rm" (x)); > + return bitpos + 1; > } > #else > #error BITS_PER_LONG not 32 or 64 Why do you put x86 assembler in asm-generic? Those files are supposed to be platform-agnostic. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html