summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCrypto/BigInt
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-07-09 11:48:38 +0100
committerLinus Groh <mail@linusgroh.de>2021-07-09 13:20:51 +0100
commita216ea4c8d595f9a1b0538db08a745767f3f643d (patch)
treeb0977c24ac45775984d0ddea9a05dde060a76f0b /Userland/Libraries/LibCrypto/BigInt
parent3014e529be3a4a230cb32cdb400c9994d064a5bf (diff)
downloadserenity-a216ea4c8d595f9a1b0538db08a745767f3f643d.zip
LibCrypto: Add missing implementation of SBI::divided_by(USBI)
Diffstat (limited to 'Userland/Libraries/LibCrypto/BigInt')
-rw-r--r--Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp9
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());