mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:28:11 +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:
parent
528891bf69
commit
791855deab
19 changed files with 77 additions and 82 deletions
|
@ -61,8 +61,7 @@ ThrowCompletionOr<BigInt const*> interpret_iso_date_time_offset(VM& vm, i32 year
|
|||
auto* epoch_nanoseconds = get_epoch_from_iso_parts(vm, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond);
|
||||
|
||||
// b. Set epochNanoseconds to epochNanoseconds - ℤ(offsetNanoseconds).
|
||||
// FIXME: Narrowing conversion from 'double' to 'i64'
|
||||
auto offset_nanoseconds_bigint = Crypto::SignedBigInteger::create_from((i64)offset_nanoseconds);
|
||||
auto offset_nanoseconds_bigint = Crypto::SignedBigInteger { offset_nanoseconds };
|
||||
epoch_nanoseconds = js_bigint(vm, epoch_nanoseconds->big_integer().minus(offset_nanoseconds_bigint));
|
||||
|
||||
// c. If ! IsValidEpochNanoseconds(epochNanoseconds) is false, throw a RangeError exception.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue