mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
AK: Silence -Wimplicit-const-int-float-conversion in clamp_to_int
This commit is contained in:
parent
871485cc0d
commit
f87a488b22
Notes:
sideshowbarker
2024-07-17 00:27:16 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/f87a488b22 Pull-request: https://github.com/SerenityOS/serenity/pull/20209
1 changed files with 2 additions and 2 deletions
|
@ -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>)
|
||||||
|
|
Loading…
Reference in a new issue