And there's always hacker's delight if you're sure popcnt is efficient: ctz(x) = pop((x & (−x)) − 1) ffs(x) = pop(x ^ (~(−x)))
D. On Fri, Nov 7, 2014 at 8:41 AM, Dawid Weiss <[email protected]> wrote: > Hi Paul, > > I think compiler-dev hotspot list would be adequate. Coincidentally, > John Rose mentioned ffs (find first bit set) ops just recently and > gave an interesting link to all sorts of implementations: > > http://markmail.org/message/siucbahtw2jzblzl > > Dawid > > On Thu, Nov 6, 2014 at 5:18 PM, Paul Elschot <[email protected]> wrote: >> Dear all, >> >> For LUCENE-6040 it would be good to have better processor support for >> selecting the i-th set bit from a 64-bit integer. >> >> Not too long ago Long.bitCount() was intrinsified in JVM's. >> >> I hope something similar will happen to a select(long x, int i) >> method. However, better processor support is needed first. >> >> This is somewhat off topic here, but does anyone know how to request >> better processor support for select operations? >> >> >> Regards, >> Paul Elschot >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
