LibCrypto: Fix -0 and 0 non-equality

SignedBigInteger::operator==(const UnsignedBigInteger&) was rejecting
all negative value before testing for equality. It now accepts negative
zero and test for a value equality with the UnsignedBigInteger.
This commit is contained in:
Lucas CHOLLET 2022-01-16 00:00:38 +01:00 committed by Sam Atkins
parent 6a937312b3
commit 4ab8ad2ed2
Notes: sideshowbarker 2024-07-17 07:09:11 +09:00

View file

@ -246,7 +246,7 @@ FLATTEN SignedBigInteger SignedBigInteger::bitwise_xor(SignedBigInteger const& o
bool SignedBigInteger::operator==(UnsignedBigInteger const& other) const
{
if (m_sign)
if (m_sign && m_unsigned_data != 0)
return false;
return m_unsigned_data == other;
}