You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know how the function as it exists is currently optimised, but in principle you can much more simply use (without risk of over/underflow):
if bits == 0{0}else{(bits-1) / B::bits() + 1}
If bits were signed (and you have a signed right shift operated that was not UB) you can just use (bits-1) >> B::bitsbits() + 1 where bitsbits() is the number of bits required to store the index into a word (i.e. 5 for 32 bit words). This is probably not practical though.
The text was updated successfully, but these errors were encountered:
I don't know how the function as it exists is currently optimised, but in principle you can much more simply use (without risk of over/underflow):
If
bits
were signed (and you have a signed right shift operated that was not UB) you can just use(bits-1) >> B::bitsbits() + 1
wherebitsbits()
is the number of bits required to store the index into a word (i.e. 5 for 32 bit words). This is probably not practical though.The text was updated successfully, but these errors were encountered: