4 ms·
On modern machines, sure, but Bresenham will smoke it on say a 6502 which has no arbitrary size shift and 8 bit words.
by hackcasual 9y ago
On modern machines, sure, but Bresenham will smoke it on say a 6502 which has no arbitrary size shift and 8 bit words.
- bonzini 9y agoYou 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.