mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier0: only ABS on signed types in ExtremeElementABS
Bug fix.
This commit is contained in:
parent
1a551739b4
commit
0f89a4e3db
@ -94,9 +94,17 @@ string Format(const char* szFormat, ...);
|
||||
template <typename Iter, typename Compare>
|
||||
Iter ExtremeElementABS(Iter first, Iter last, Compare compare)
|
||||
{
|
||||
auto abs_compare = [compare](LONG a, LONG b)
|
||||
using ValueType = typename std::iterator_traits<Iter>::value_type;
|
||||
auto abs_compare = [compare](ValueType a, ValueType b)
|
||||
{
|
||||
return compare(abs(a), abs(b));
|
||||
if constexpr (std::is_signed_v<ValueType>)
|
||||
{
|
||||
return compare(abs(a), abs(b));
|
||||
}
|
||||
else
|
||||
{
|
||||
return compare(a, b);
|
||||
}
|
||||
};
|
||||
|
||||
return std::min_element(first, last, abs_compare);
|
||||
|
Loading…
x
Reference in New Issue
Block a user