From 362338ee5e7920ab62ad49b3bd5976f9d347dac0 Mon Sep 17 00:00:00 2001 From: docentYT <63965954+docentYT@users.noreply.github.com> Date: Sat, 2 May 2026 00:43:02 +0200 Subject: [PATCH] Refactor min_speed --- utilities/utilities.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utilities/utilities.h b/utilities/utilities.h index 15be1b01..23ba31be 100644 --- a/utilities/utilities.h +++ b/utilities/utilities.h @@ -288,15 +288,15 @@ template Type_ quantize(Type_ const Value, Type_ const Step) return (Step * std::round(Value / Step)); } -template Type_ min_speed(Type_ const Left, Type_ const Right) +template T min_speed(T const Left, T const Right) { - - if (Left == Right) - { + constexpr T none = T(-1); + if (Left == none) + return Right; + if (Right == none) return Left; - } - return std::min((Left != -1 ? Left : std::numeric_limits::max()), (Right != -1 ? Right : std::numeric_limits::max())); + return std::min(Left, Right); } template Type_ interpolate(Type_ const &First, Type_ const &Second, float const Factor)