From c84d0fc943ccb0340046a8bdb74006ef796b2756 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 8 Oct 2023 06:53:45 +0200 Subject: now use Math::sqrt at compile time --- src/path-search-dijkstra.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/path-search-dijkstra.cpp') diff --git a/src/path-search-dijkstra.cpp b/src/path-search-dijkstra.cpp index e88461dd..4a71ef8d 100644 --- a/src/path-search-dijkstra.cpp +++ b/src/path-search-dijkstra.cpp @@ -14,6 +14,7 @@ namespace { constexpr auto chunk_size = iTILE_SIZE2 * TILE_MAX_DIM; constexpr auto div_size = path_search::div_size; constexpr auto min_size = path_search::min_size; +constexpr auto goal_distance = div_size; template requires std::is_arithmetic_v @@ -40,7 +41,7 @@ constexpr auto directions = [] constexpr { struct pair { Vector2i dir; uint32_t len; }; constexpr auto len1 = div_size; - constexpr auto len2 = (uint32_t)(math::sqrt((float)len1.dot()) + 0.5f); // NOLINT + constexpr auto len2 = (uint32_t)(len1.length() + 0.5f); // NOLINT std::array array = {{ { { -1, -1 }, len2 }, { { 1, 1 }, len2 }, -- cgit v1.2.3