1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +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:
Andreas Kling 2019-10-29 16:36:50 +01:00
parent 5442e365c9
commit 014f8ca8c4
6 changed files with 120 additions and 87 deletions

View file

@ -120,11 +120,17 @@ void JsonValue::serialize(Builder& builder) const
builder.appendf("%g", m_value.as_double);
break;
#endif
case Type::Int:
builder.appendf("%d", m_value.as_int);
case Type::Int32:
builder.appendf("%d", as_i32());
break;
case Type::UnsignedInt:
builder.appendf("%u", m_value.as_uint);
case Type::Int64:
builder.appendf("%lld", as_i64());
break;
case Type::UnsignedInt32:
builder.appendf("%u", as_u32());
break;
case Type::UnsignedInt64:
builder.appendf("%llu", as_u64());
break;
case Type::Undefined:
builder.append("undefined");