mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-30 11:37:16 +02:00
LibCrypto: Add operator>() to UnsignedBigInteger and SignedBigInteger
Piggybacking on operator!=() and operator<().
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 10:12:32 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/89641d90db7 Pull-request: https://github.com/SerenityOS/serenity/pull/8534
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user