Avoid calling std::abs and divsd instruction in CSGCell::distance

This commit is contained in:
Paul Romano 2021-01-13 14:50:30 -06:00
parent 5c4d954930
commit c704ae5ac1

View file

@ -514,7 +514,7 @@ CSGCell::distance(Position r, Direction u, int32_t on_surface, Particle* p) cons
// Check if this distance is the new minimum.
if (d < min_dist) {
if (std::abs(d - min_dist) / min_dist >= FP_PRECISION) {
if (min_dist - d >= FP_PRECISION*min_dist) {
min_dist = d;
i_surf = -token;
}