On Mon, Aug 13, 2018 at 10:10 AM, Ivan Gerasimov <[email protected]>
wrote:
> Hi Martin!
>
> Good point about the command line flags, thanks!
>
> These variants are close to numberOfTrailingZeros_07 that I've already
> tested, though you did better by saving one arithmetic operation at the
> return line!
>
>
Right. At this point
return n + i - (i >> 1);
i is either 1 or 3, and
i - (i >> 1)
is equivalent to
1 + (i >>> 1)
so just initialize n to 1 instead. Very much like
Integer.numberOfLeadingZeros does.