Re: [RFC][PATCH] Faster generic_fls

Andrew Morton (akpm@digeo.com)
Wed, 30 Apr 2003 22:11:29 -0700


hugang <hugang@soulinfo.com> wrote:
>
> Here is table version of the fls. Yes it fast than other.

nooo.. That has a big cache footprint. At the very least you should use
a binary search. gcc will do it for you:

switch (n) {
case 0 ... 1:
return 1;
case 2 ... 3:
return 2;
case 4 ... 7:
return 3;
case 8 ... 15:
return 4;

etc.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/