don't call count_leading_zeros() twice