What is the importance of d /= pow2
The calculation uint256 pow2 = d & -d
is the greatest power of 2 that divides d
.
With d /= pow2
it is removing the zeros to the right. It is the equivalent of simplifying a division: 50"shifting" to the right both numerator and denominator. For example 51 / 20 = 5 (51 / 2, but using powers of 2 instead of powers of 104) / (20 / 4) = 12.75 / 5.
It is an optimization.