mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2025-08-08 09:25:00 +00:00
Couple of small consistency changes in the rapidjson implementation.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
@@ -46,7 +46,7 @@ cycle_t::cycle_t(const rapidjson::Value& input)
|
||||
: m_address((uint8_t)input[0].GetInt64()),
|
||||
m_value((uint8_t)input[1].GetInt64()),
|
||||
m_action(to_action(input[2].GetString())) {
|
||||
assert(input.size() == 3);
|
||||
assert(input.Size() == 3);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -47,7 +47,7 @@ public:
|
||||
#endif
|
||||
|
||||
#ifdef USE_RAPIDJSON_JSON
|
||||
cycle_t(const rapidjson::Value& serialised);
|
||||
cycle_t(const rapidjson::Value& input);
|
||||
#endif
|
||||
|
||||
#ifdef USE_BOOST_JSON
|
||||
|
@@ -25,9 +25,8 @@ cycles_t::cycles_t(simdjson::dom::array input) {
|
||||
|
||||
cycles_t::cycles_t(const rapidjson::Value& input) {
|
||||
assert(m_cycles.empty());
|
||||
auto array = input.GetArray();
|
||||
m_cycles.reserve(array.Size());
|
||||
for (const auto& entry : array)
|
||||
m_cycles.reserve(input.Size());
|
||||
for (const auto& entry : input.GetArray())
|
||||
add(entry);
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
#endif
|
||||
|
||||
#ifdef USE_RAPIDJSON_JSON
|
||||
cycles_t(const rapidjson::Value& serialised);
|
||||
cycles_t(const rapidjson::Value& input);
|
||||
#endif
|
||||
|
||||
#ifdef USE_BOOST_JSON
|
||||
|
@@ -21,13 +21,11 @@ ram_t::ram_t(simdjson::dom::array input) {
|
||||
#ifdef USE_RAPIDJSON_JSON
|
||||
|
||||
ram_t::ram_t(const rapidjson::Value& input) {
|
||||
auto array = input.GetArray();
|
||||
m_bytes.reserve(input.Size());
|
||||
for (const auto& byte : array) {
|
||||
const auto& ram_entry_array = byte.GetArray();
|
||||
assert(ram_entry_array.Size() == 2);
|
||||
const auto address = (uint16_t)ram_entry_array[0].GetInt64();
|
||||
const auto value = (uint8_t)ram_entry_array[1].GetInt64();
|
||||
for (const auto& byte : input.GetArray()) {
|
||||
assert(byte.Size() == 2);
|
||||
const auto address = (uint16_t)byte[0].GetInt64();
|
||||
const auto value = (uint8_t)byte[1].GetInt64();
|
||||
m_bytes.push_back({ address, value });
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,7 @@ state_t::state_t(const rapidjson::Value& serialised)
|
||||
m_x((uint8_t)serialised["x"].GetInt64()),
|
||||
m_y((uint8_t)serialised["y"].GetInt64()),
|
||||
m_p((uint8_t)serialised["p"].GetInt64()),
|
||||
m_ram(serialised["ram"].GetArray()) {}
|
||||
m_ram(serialised["ram"]) {}
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user