mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-18 08:20:44 +00:00
LibJS: Add all of the DataView.prototype.set* methods
This commit is contained in:
parent
c54b9a6920
commit
d7a70eb77c
Notes:
sideshowbarker
2024-07-18 12:17:02 +09:00
Author: https://github.com/IdanHo
Commit: d7a70eb77c
Pull-request: https://github.com/SerenityOS/serenity/pull/8045
Reviewed-by: https://github.com/linusg
8 changed files with 203 additions and 0 deletions
|
@ -55,6 +55,14 @@ String SignedBigInteger::to_base10() const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
u64 SignedBigInteger::to_u64() const
|
||||
{
|
||||
u64 unsigned_value = m_unsigned_data.to_u64();
|
||||
if (!m_sign)
|
||||
return unsigned_value;
|
||||
return ~(unsigned_value - 1); // equivalent to `-unsigned_value`, but doesnt trigger UBSAN
|
||||
}
|
||||
|
||||
FLATTEN SignedBigInteger SignedBigInteger::plus(const SignedBigInteger& other) const
|
||||
{
|
||||
// If both are of the same sign, just add the unsigned data and return.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue