1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:34:59 +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

@ -55,16 +55,12 @@ int main(int argc, char** argv)
Vector<JsonValue> sorted_regions = json.value().as_array().values();
quick_sort(sorted_regions, [](auto& a, auto& b) {
return a.as_object().get("address").to_u64() < b.as_object().get("address").to_u64();
return a.as_object().get("address").to_addr() < b.as_object().get("address").to_addr();
});
for (auto& value : sorted_regions) {
auto& map = value.as_object();
#if ARCH(I386)
auto address = map.get("address").to_u32();
#else
auto address = map.get("address").to_u64();
#endif
auto address = map.get("address").to_addr();
auto size = map.get("size").to_string();
auto access = String::formatted("{}{}{}{}{}",