mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 18:00:16 +00:00
LibCrypto: Remove the concept of invalid big integers
This concept is rarely used in codebase and very much error-prone if you forget to check it. Instead, make it so that operations that would produce invalid integers return an error instead.
This commit is contained in:
parent
14387e5411
commit
5f1a30197c
Notes:
github-actions[bot]
2025-04-28 10:06:55 +00:00
Author: https://github.com/devgianlu
Commit: 5f1a30197c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4482
Reviewed-by: https://github.com/gmta ✅
12 changed files with 34 additions and 109 deletions
|
@ -21,7 +21,6 @@ GC::Ref<BigInt> BigInt::create(VM& vm, Crypto::SignedBigInteger big_integer)
|
|||
BigInt::BigInt(Crypto::SignedBigInteger big_integer)
|
||||
: m_big_integer(move(big_integer))
|
||||
{
|
||||
VERIFY(!m_big_integer.is_invalid());
|
||||
}
|
||||
|
||||
ErrorOr<String> BigInt::to_string() const
|
||||
|
|
|
@ -965,7 +965,7 @@ Crypto::SignedBigInteger apply_unsigned_rounding_mode(Crypto::SignedDivisionResu
|
|||
auto d1 = x.remainder.unsigned_value();
|
||||
|
||||
// 7. Let d2 be r2 – x.
|
||||
auto d2 = increment.minus(x.remainder.unsigned_value());
|
||||
auto d2 = MUST(increment.minus(x.remainder.unsigned_value()));
|
||||
|
||||
// 8. If d1 < d2, return r1.
|
||||
if (d1 < d2)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue