| Ruud H.G. van Tol on Thu, 30 Mar 2023 19:44:32 +0200 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: bit_ffs |
On 2023-03-30 19:02, Ruud H.G. van Tol wrote:
Might be interesting to add: https://en.wikipedia.org/wiki/Find_first_set https://www.man7.org/linux/man-pages/man3/ffs.3.htmlhttps://www.go4expert.com/articles/builtin-gcc-functions-builtinclz-t29238/Or are those too low-level? bit_ffs, bit_ctz
Count trailing set bits: bit_cts(n) = logint( 1 + bitand(n, bitneg(n) - 1), 2 ) (no idea yet if that is a good implementation) Would also be nice to have a turbo version of that. -- Ruud