Maybe I am mistaken, but could the above (starting from `let raw = ...`) be reduced to just: uint::bits - (size - 1).leading_zeros(), since the subtraction cannot underflow due to the if-guard above. That would save a conditional branch.