16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-18 01:59:19 +02:00

Refactor min_speed

This commit is contained in:
docentYT
2026-05-02 00:43:02 +02:00
parent 28baad8c5b
commit 362338ee5e

View File

@@ -288,15 +288,15 @@ template <typename Type_> Type_ quantize(Type_ const Value, Type_ const Step)
return (Step * std::round(Value / Step));
}
template <typename Type_> Type_ min_speed(Type_ const Left, Type_ const Right)
template <typename T> 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<Type_>::max()), (Right != -1 ? Right : std::numeric_limits<Type_>::max()));
return std::min(Left, Right);
}
template <typename Type_> Type_ interpolate(Type_ const &First, Type_ const &Second, float const Factor)