>>107129464
>By that I mean your way of doing the shifts(I am not sure even why they work)
nta but
if length = 4
you & the bucket with itself, but bit shifted by 1 length - 1 times
00111100
00011110
00001111
00000111
-------------
00000100 -> is not zero, that means 1's are contiguous
00101100
00010110
00001011
00000101
-------------
00000000 -> is zero, that means 1's are not contiguous.
theres a problem with his offset computations though
001111000000
000111100000
000011110000
000001111000
-------------------
000001000000
return bid * 64 + bits.trailing_zeros();
0*64 + 6 != 2
also what about this:
00111100001111000000
00011110000111100000
00001111000011110000
00000111100001111000
-------------------------
00000100000001000000
if you massage the trailing zeroes trick to work, this example will give you the wrong offset. its gonna give you the second one