1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:27:35 +00:00

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

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;
}