From c704ae5ac18ebd6d79cf2f1c62e12d271cd994f6 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 13 Jan 2021 14:50:30 -0600 Subject: [PATCH] Avoid calling std::abs and divsd instruction in CSGCell::distance --- src/cell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cell.cpp b/src/cell.cpp index 6ca39749fd..418258d8b2 100644 --- a/src/cell.cpp +++ b/src/cell.cpp @@ -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; }