lkml.org 
[lkml]   [2003]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC][PATCH] Faster generic_fls
Date
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/

\
 
 \ /
  Last update: 2005-03-22 13:35    [W:0.145 / U:7.700 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site