mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
LibJS: Add all of the DataView.prototype.get* methods
This commit is contained in:
parent
e4d267d4fb
commit
c54b9a6920
6 changed files with 206 additions and 0 deletions
|
@ -47,6 +47,19 @@ public:
|
|||
static SignedBigInteger import_data(const StringView& data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); }
|
||||
static SignedBigInteger import_data(const u8* ptr, size_t length);
|
||||
|
||||
static SignedBigInteger create_from(i64 value)
|
||||
{
|
||||
auto sign = false;
|
||||
u64 unsigned_value;
|
||||
if (value < 0) {
|
||||
unsigned_value = static_cast<u64>(-(value + 1)) + 1;
|
||||
sign = true;
|
||||
} else {
|
||||
unsigned_value = value;
|
||||
}
|
||||
return SignedBigInteger { UnsignedBigInteger::create_from(unsigned_value), sign };
|
||||
}
|
||||
|
||||
size_t export_data(Bytes, bool remove_leading_zeros = false) const;
|
||||
|
||||
static SignedBigInteger from_base10(StringView str);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue