mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
LibCrypto+LibJS: Remove the create_from methods from BigInteger
Instead we just use a specific constructor. With this set of constructors using curly braces for constructing is highly recommended. As then it will not do too many implicit conversions which could lead to unexpected loss of data or calling the much slower double constructor. Also to ensure we don't feed (Un)SignedBigInteger infinities we throw RangeError earlier for Durations.
This commit is contained in:
@@ -1082,7 +1082,7 @@ Crypto::SignedBigInteger round_number_to_increment(Crypto::SignedBigInteger cons
|
||||
if (increment == 1)
|
||||
return x;
|
||||
|
||||
auto increment_big_int = Crypto::UnsignedBigInteger::create_from(increment);
|
||||
auto increment_big_int = Crypto::UnsignedBigInteger { increment };
|
||||
|
||||
// 1. Let quotient be x / increment.
|
||||
auto division_result = x.divided_by(increment_big_int);
|
||||
@@ -1137,7 +1137,7 @@ Crypto::SignedBigInteger round_number_to_increment_as_if_positive(Crypto::Signed
|
||||
if (increment == 1)
|
||||
return x;
|
||||
|
||||
auto increment_big_int = Crypto::UnsignedBigInteger::create_from(increment);
|
||||
auto increment_big_int = Crypto::UnsignedBigInteger { increment };
|
||||
|
||||
// 1. Let quotient be x / increment.
|
||||
auto division_result = x.divided_by(increment_big_int);
|
||||
|
||||
Reference in New Issue
Block a user