Part of #21421: using std::numerics for finding bounds

This commit is contained in:
Claudio Tiecher 2024-04-29 22:01:38 +02:00
parent c4cc84c454
commit c32020bb96
1 changed files with 3 additions and 1 deletions

View File

@ -501,8 +501,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;