mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 09:18:52 +00:00
AK: Allow JsonValue to store 64-bit integers internally
Add dedicated internal types for Int64 and UnsignedInt64. This makes it a bit more straightforward to work with 64-bit numbers (instead of just implicitly storing them as doubles.)
This commit is contained in:
parent
5442e365c9
commit
014f8ca8c4
Notes:
sideshowbarker
2024-07-19 11:30:22 +09:00
Author: https://github.com/awesomekling
Commit: 014f8ca8c4
6 changed files with 120 additions and 87 deletions
|
@ -93,15 +93,29 @@ GVariant::GVariant(const JsonValue& value)
|
|||
return;
|
||||
}
|
||||
|
||||
if (value.is_int()) {
|
||||
if (value.is_i32()) {
|
||||
m_type = Type::Int;
|
||||
m_value.as_int = value.as_int();
|
||||
m_value.as_int = value.as_i32();
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.is_uint()) {
|
||||
if (value.is_u32()) {
|
||||
m_type = Type::UnsignedInt;
|
||||
m_value.as_uint = value.as_uint();
|
||||
m_value.as_uint = value.as_u32();
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.is_i64()) {
|
||||
// FIXME: GVariant should have a 64-bit internal type.
|
||||
m_type = Type::Int;
|
||||
m_value.as_int = value.to_i32();
|
||||
return;
|
||||
}
|
||||
|
||||
if (value.is_u64()) {
|
||||
// FIXME: GVariant should have a 64-bit internal type.
|
||||
m_type = Type::UnsignedInt;
|
||||
m_value.as_uint = value.to_u32();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue