4 ms·
Yes, but here it's about avoiding multiplication (and division). I suspect on a modern processor the branches (ie "if"s) in Bresenham's algorithm are gonna be
by eru 2y ago
Yes, but here it's about avoiding multiplication (and division).
I suspect on a modern processor the branches (ie "if"s) in Bresenham's algorithm are gonna be more expensive than the multiplications and divisions in the naive algorithm.
- ack_complete 2y agoBresenham is easy to implement branchlessly using conditional moves or arithmetic. It also produces a regular pattern of branches that is favorable for modern branch predictors that can do pattern prediction.