mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibJS: Add all of the DataView.prototype.set* methods
This commit is contained in:
committed by
Linus Groh
parent
c54b9a6920
commit
d7a70eb77c
Notes:
sideshowbarker
2024-07-18 12:17:02 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/d7a70eb77ce Pull-request: https://github.com/SerenityOS/serenity/pull/8045 Reviewed-by: https://github.com/linusg
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user