Re: [CHALLENGE] finding rightmost zero bit





Michel OLAGNON wrote:



I claim the slowest but it's a one-liner:

pos = nint (log (real(ieor(n,n+1)+1, kind=renough)) / log (2.0_renough))

:-)

How about this for the fastest untested one-liner ;>

pos = count(iand(not(n),ieor(n,n+1))> [0,1,2,4,8,16,32,64] )

It seemed to work for the numbers up to 32 that I could
mentally convert into binary.  And, it's not only easily
extensible, but it's obvious how it works!

*** Hendrickson

.