1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:07:45 +00:00

AK: Add a getter to JsonValue to get machine-native addresses

This commit is contained in:
Gunnar Beutner 2021-07-21 19:57:05 +02:00 committed by Andreas Kling
parent 36e36507d5
commit 11e02f222d
3 changed files with 14 additions and 9 deletions

View file

@ -91,6 +91,15 @@ public:
u32 to_u32(u32 default_value = 0) const { return to_number<u32>(default_value); }
u64 to_u64(u64 default_value = 0) const { return to_number<u64>(default_value); }
FlatPtr to_addr(FlatPtr default_value = 0) const
{
#ifdef __LP64__
return to_u64(default_value);
#else
return to_u32(default_value);
#endif
}
bool to_bool(bool default_value = false) const
{
if (!is_bool())