- Optimise fFindDistance2D() to multiply by inverse rather than divide by a constant.

This commit is contained in:
Mitchell Richters 2021-07-10 22:08:48 +10:00
parent 5d7938c24e
commit b5b9452adb

View file

@ -58,9 +58,9 @@ double fFindDistance2D(int x, int y)
if (x<y)
std::swap(x,y);
double t = y + (y / 2.);
double t = y + (y * (1. / 2.));
return (x - (x / 32.) - (x / 128.) + (t / 4.) + (t / 64.));
return (x - (x * (1. / 32.)) - (x * (1. / 128.)) + (t * (1. / 4.)) + (t * (1. / 64.)));
}