mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:47:36 +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
|
@ -182,9 +182,9 @@ i64 get_iana_time_zone_offset_nanoseconds(BigInt const& epoch_nanoseconds, Strin
|
|||
// get_time_zone_offset(). We can safely assume that the TZDB has no useful information that far
|
||||
// into the past and future anyway, so clamp it to the i64 range.
|
||||
Time time;
|
||||
if (seconds < Crypto::SignedBigInteger::create_from(NumericLimits<i64>::min()))
|
||||
if (seconds < Crypto::SignedBigInteger { NumericLimits<i64>::min() })
|
||||
time = Time::min();
|
||||
else if (seconds > Crypto::SignedBigInteger::create_from(NumericLimits<i64>::max()))
|
||||
else if (seconds > Crypto::SignedBigInteger { NumericLimits<i64>::max() })
|
||||
time = Time::max();
|
||||
else
|
||||
time = Time::from_seconds(*seconds.to_base(10).to_int<i64>());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue