diff options
author | Linus Groh <mail@linusgroh.de> | 2021-07-09 11:48:38 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-07-09 13:20:51 +0100 |
commit | a216ea4c8d595f9a1b0538db08a745767f3f643d (patch) | |
tree | b0977c24ac45775984d0ddea9a05dde060a76f0b | |
parent | 3014e529be3a4a230cb32cdb400c9994d064a5bf (diff) | |
download | serenity-a216ea4c8d595f9a1b0538db08a745767f3f643d.zip |
LibCrypto: Add missing implementation of SBI::divided_by(USBI)
-rw-r--r-- | Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp index 795d238eea..8c6de49b61 100644 --- a/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp +++ b/Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp @@ -156,6 +156,15 @@ FLATTEN SignedBigInteger SignedBigInteger::multiplied_by(UnsignedBigInteger cons return { unsigned_value().multiplied_by(other), m_sign }; } +FLATTEN SignedDivisionResult SignedBigInteger::divided_by(UnsignedBigInteger const& divisor) const +{ + auto division_result = unsigned_value().divided_by(divisor); + return { + { move(division_result.quotient), m_sign }, + { move(division_result.remainder), m_sign }, + }; +} + FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(const SignedBigInteger& other) const { auto result = bitwise_or(other.unsigned_value()); |