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:

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