LibCrypto: Define UnsignedBigInteger::operator<=

We have all comparison operators except less-than-or-equal already.
This commit is contained in:
Timothy Flynn 2024-11-17 13:27:52 -05:00 committed by Tim Flynn
parent 63a5717bc7
commit e236f1d2ae
Notes: github-actions[bot] 2024-11-21 00:07:11 +00:00
2 changed files with 6 additions and 0 deletions

View file

@ -601,6 +601,11 @@ bool UnsignedBigInteger::operator<(UnsignedBigInteger const& other) const
return false;
}
bool UnsignedBigInteger::operator<=(UnsignedBigInteger const& other) const
{
return *this < other || *this == other;
}
bool UnsignedBigInteger::operator>(UnsignedBigInteger const& other) const
{
return *this != other && !(*this < other);

View file

@ -128,6 +128,7 @@ public:
[[nodiscard]] bool operator==(UnsignedBigInteger const& other) const;
[[nodiscard]] bool operator!=(UnsignedBigInteger const& other) const;
[[nodiscard]] bool operator<(UnsignedBigInteger const& other) const;
[[nodiscard]] bool operator<=(UnsignedBigInteger const& other) const;
[[nodiscard]] bool operator>(UnsignedBigInteger const& other) const;
[[nodiscard]] bool operator>=(UnsignedBigInteger const& other) const;