More Low-level Optimizations (3)
This test can be made a test against a value of zero if the inital value of
scaledFraction has 2*dx subtracted from it. Giving outside the loop:
OffsetScaledFraction = dx + 2*dy - 2*dx = 2*dy - dx,
and the inner loop becomes
OffsetScaledFraction += 2*dy
if (OffsetScaledFraction >= 0) {
y = y +1; OffsetScaledFraction -= 2*dx;
}
The net result is that we might as well double the values of dy and dx (this
can be accomplished with either an add or a shift).