Browse Source

LibCrypto: Add missing implementation of SBI::divided_by(USBI)

Linus Groh 4 năm trước cách đây
mục cha
commit
a216ea4c8d
1 tập tin đã thay đổi với 9 bổ sung0 xóa
  1. 9 0
      Userland/Libraries/LibCrypto/BigInt/SignedBigInteger.cpp

+ 9 - 0
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());