Note how one
is initialized.
uint32_t one = 1uL << 30;
That's 230, or 1073741824
. Which is also 415.
This line:
one >>= 2;
Is equivalent to
one = one / 4;
So the pseudocode for what's happening is:
one
= 415if
one
is more thana_nInput
one
= 414
if
one
is still more thana_nInput
one
= 413
(and so on...)
Eventually, one
will not be more than a_nInput
.
// "one" starts at the highest power of four less than or equal to a_nInput