3 ms·
You don't need arbitrary shift if you make the fractional part a multiple of the word size. But yes, replacing Bresenham for fixed point kind of misses the poin
by bonzini 9y ago
You don't need arbitrary shift if you make the fractional part a multiple of the word size. But yes, replacing Bresenham for fixed point kind of misses the point, also because you can write the Bresenham inner loop in a branchless way. For example, inverting the sign of "d" compared to the parent's blog post lets you do this:
ext = -(d<0);
d -= 2*dy;
y -= ext;
d += ext & (2*dx);
where ext is really just a sign extension of d so it's very cheap to compute.
On the other hand, fixed point is better than Bresenham for the anti-aliased case present in the original article.