diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp index 3873da32ce..a15a45403c 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp @@ -202,6 +202,11 @@ bool SignedBigInteger::operator<(const UnsignedBigInteger& other) const return m_unsigned_data < other; } +bool SignedBigInteger::operator>(const UnsignedBigInteger& other) const +{ + return *this != other && !(*this < other); +} + FLATTEN SignedBigInteger SignedBigInteger::shift_left(size_t num_bits) const { return SignedBigInteger { m_unsigned_data.shift_left(num_bits), m_sign }; @@ -261,4 +266,9 @@ bool SignedBigInteger::operator<(const SignedBigInteger& other) const return m_unsigned_data < other.m_unsigned_data; } +bool SignedBigInteger::operator>(const SignedBigInteger& other) const +{ + return *this != other && !(*this < other); +} + } diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h index 9e0416d607..b3adcdb8bb 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.h @@ -121,10 +121,12 @@ public: bool operator==(const SignedBigInteger& other) const; bool operator!=(const SignedBigInteger& other) const; bool operator<(const SignedBigInteger& other) const; + bool operator>(const SignedBigInteger& other) const; bool operator==(const UnsignedBigInteger& other) const; bool operator!=(const UnsignedBigInteger& other) const; bool operator<(const UnsignedBigInteger& other) const; + bool operator>(const UnsignedBigInteger& other) const; private: bool m_sign { false }; diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp index 501a563337..135bcf5270 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.cpp @@ -332,6 +332,11 @@ bool UnsignedBigInteger::operator<(const UnsignedBigInteger& other) const return false; } +bool UnsignedBigInteger::operator>(const UnsignedBigInteger& other) const +{ + return *this != other && !(*this < other); +} + } void AK::Formatter::format(FormatBuilder& fmtbuilder, const Crypto::UnsignedBigInteger& value) diff --git a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h index 80f8cf393b..e37c9e95b4 100644 --- a/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h +++ b/Userland/Libraries/LibCrypto/BigInt/UnsignedBigInteger.h @@ -98,6 +98,7 @@ public: bool operator==(const UnsignedBigInteger& other) const; bool operator!=(const UnsignedBigInteger& other) const; bool operator<(const UnsignedBigInteger& other) const; + bool operator>(const UnsignedBigInteger& other) const; private: friend class UnsignedBigIntegerAlgorithms;