AK: Silence -Wimplicit-const-int-float-conversion in clamp_to_int

This commit is contained in:
Andrew Kaster 2023-08-07 14:45:43 -06:00 committed by Andrew Kaster
parent 871485cc0d
commit f87a488b22
Notes: sideshowbarker 2024-07-17 00:27:16 +09:00

View file

@ -1017,10 +1017,10 @@ constexpr T pow(T x, T y)
template<typename T> template<typename T>
constexpr int clamp_to_int(T value) constexpr int clamp_to_int(T value)
{ {
if (value >= NumericLimits<int>::max()) if (value >= static_cast<T>(NumericLimits<int>::max()))
return NumericLimits<int>::max(); return NumericLimits<int>::max();
if (value <= NumericLimits<int>::min()) if (value <= static_cast<T>(NumericLimits<int>::min()))
return NumericLimits<int>::min(); return NumericLimits<int>::min();
if constexpr (IsFloatingPoint<T>) if constexpr (IsFloatingPoint<T>)