AK: Fix UFixedBigInt comparison operators

Instead of using the specified type U like we want,
we were using the type T all along when comparing with
smaller integers. This is now fixed.
This commit is contained in:
B0IIZZ 2022-01-01 22:21:19 +01:00 committed by Brian Gianforcaro
parent 143465b23a
commit 6124050187
Notes: sideshowbarker 2024-07-17 21:44:23 +09:00

View file

@ -135,32 +135,32 @@ public:
return m_low || m_high;
}
template<Unsigned U>
requires(sizeof(T) >= sizeof(U)) constexpr bool operator==(const T& other) const
requires(sizeof(T) >= sizeof(U)) constexpr bool operator==(const U& other) const
{
return !m_high && m_low == other;
}
template<Unsigned U>
requires(sizeof(T) >= sizeof(U)) constexpr bool operator!=(const T& other) const
requires(sizeof(T) >= sizeof(U)) constexpr bool operator!=(const U& other) const
{
return m_high || m_low != other;
}
template<Unsigned U>
requires(sizeof(T) >= sizeof(U)) constexpr bool operator>(const T& other) const
requires(sizeof(T) >= sizeof(U)) constexpr bool operator>(const U& other) const
{
return m_high || m_low > other;
}
template<Unsigned U>
requires(sizeof(T) >= sizeof(U)) constexpr bool operator<(const T& other) const
requires(sizeof(T) >= sizeof(U)) constexpr bool operator<(const U& other) const
{
return !m_high && m_low < other;
}
template<Unsigned U>
requires(sizeof(T) >= sizeof(U)) constexpr bool operator>=(const T& other) const
requires(sizeof(T) >= sizeof(U)) constexpr bool operator>=(const U& other) const
{
return *this == other || *this > other;
}
template<Unsigned U>
requires(sizeof(T) >= sizeof(U)) constexpr bool operator<=(const T& other) const
requires(sizeof(T) >= sizeof(U)) constexpr bool operator<=(const U& other) const
{
return *this == other || *this < other;
}