Skip to content

Commit

Permalink
Part of #21421: using std::numerics for finding bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
janclod committed Apr 29, 2024
1 parent 94ebd65 commit ab41350
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/openrct2/util/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,10 @@ std::vector<uint8_t> Ungzip(const void* data, const size_t dataLen)
return output;
}

template<typename T> constexpr T kAddClampBody(T value, T value_to_add, T min_cap, T max_cap)
template<typename T> constexpr T kAddClampBody(T value, T value_to_add)
{
auto max_cap = std::numeric_limits<T>::max();
auto min_cap = std::numeric_limits<T>::lowest();
if ((value_to_add > 0) && (value > (max_cap - (value_to_add))))
{
return max_cap;
Expand Down

0 comments on commit ab41350

Please sign in to comment.