mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Tier0: fix compiler specific compile error
This code doesn't compile on VS2017 15.6 (does on 2019 and above). We also don't need to ABS; removed the ABS code as the code is currently only used for unsigned types and we probably do want to take the sign into account when getting mins/maxs from signed values too. If not then this could always be ABS'd by the caller to explicitly set the behavior.
This commit is contained in:
parent
a809b1f262
commit
9a9e84f974
@ -92,34 +92,21 @@ string Format(const char* szFormat, ...);
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Array
|
// Array
|
||||||
template <typename Iter, typename Compare>
|
template <typename Iter, typename Compare>
|
||||||
Iter ExtremeElementABS(Iter first, Iter last, Compare compare)
|
inline Iter ExtremeElement(Iter first, Iter last, Compare compare)
|
||||||
{
|
{
|
||||||
using ValueType = typename std::iterator_traits<Iter>::value_type;
|
return std::min_element(first, last, compare);
|
||||||
auto abs_compare = [compare](ValueType a, ValueType 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iter> // Return lowest element in array.
|
template <typename Iter> // Return lowest element in array.
|
||||||
Iter MinElementABS(Iter first, Iter last)
|
inline Iter MinElement(Iter first, Iter last)
|
||||||
{
|
{
|
||||||
return ExtremeElementABS(first, last, std::less<>());
|
return ExtremeElement(first, last, std::less<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Iter> // Return highest element in array.
|
template <typename Iter> // Return highest element in array.
|
||||||
Iter MaxElementABS(Iter first, Iter last)
|
inline Iter MaxElement(Iter first, Iter last)
|
||||||
{
|
{
|
||||||
return ExtremeElementABS(first, last, std::greater<>());
|
return ExtremeElement(first, last, std::greater<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -379,7 +379,7 @@ void CCrashHandler::FormatFPU(const char* const pszRegister, const M128A* const
|
|||||||
*reinterpret_cast<const FLOAT*>(&nVec[2]),
|
*reinterpret_cast<const FLOAT*>(&nVec[2]),
|
||||||
*reinterpret_cast<const FLOAT*>(&nVec[3]));
|
*reinterpret_cast<const FLOAT*>(&nVec[3]));
|
||||||
|
|
||||||
const DWORD nHighest = *MaxElementABS(std::begin(nVec), std::end(nVec));
|
const DWORD nHighest = *MaxElement(std::begin(nVec), std::end(nVec));
|
||||||
|
|
||||||
if (nHighest >= 1000000)
|
if (nHighest >= 1000000)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user