dda_maths.c: pick a nugget from @phord's distance calculation rework.

This commit is contained in:
Markus Hitter 2013-11-29 00:38:10 +01:00
parent 8a476e2fba
commit 68cc213a70
1 changed files with 3 additions and 0 deletions

View File

@ -74,6 +74,9 @@ const int32_t muldivQR(int32_t multiplicand, uint32_t qn, uint32_t rn,
uint32_t approx_distance(uint32_t dx, uint32_t dy) {
uint32_t min, max, approx;
// If either axis is zero, return the other one.
if (dx == 0 || dy == 0) return dx + dy;
if ( dx < dy ) {
min = dx;
max = dy;