Messages in this thread | | | From | Daniel Phillips <> | Subject | Re: [RFC][PATCH] Faster generic_fls | Date | Wed, 30 Apr 2003 15:03:38 +0200 |
| |
On Wednesday 30 April 2003 13:14, Falk Hueffner wrote: > gcc 3.4 will have a __builtin_ctz function which can be used for this. > It will emit special instructions on CPUs that support it (i386, Alpha > EV67), and use a lookup table on others, which is very boring, but > also faster.
Actually, __builtin_clz:
http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
Not having a gcc 2.4 handy, I couldn't test it, but I did notice that the built-in ffs is very fast. Perhaps all such standard functions will end up as built-ins instead of kernel library functions, some very long time in the future. If old compilers ever do finally fade away, that is.
It's somewhat annoying that __builtin_clz leaves the all-ones case dangling instead of returning -1.
Regards,
Daniel
- 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/
| |