mirror of
https://github.com/MoleskiCoder/EightBit.git
synced 2024-12-22 09:30:32 +00:00
Remove some build warnings.
Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
parent
91221aa975
commit
77a2c08c20
@ -7,7 +7,7 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
#ifdef USE_JSONCPP_JSON
|
#ifdef USE_JSONCPP_JSON
|
||||||
std::unique_ptr<Json::CharReader> opcode_test_suite_t::m_reader;
|
std::unique_ptr<Json::CharReader> opcode_test_suite_t::m_parser;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SIMDJSON_JSON
|
#ifdef USE_SIMDJSON_JSON
|
||||||
std::unique_ptr<simdjson::dom::parser> opcode_test_suite_t::m_parser;
|
std::unique_ptr<simdjson::dom::parser> opcode_test_suite_t::m_parser;
|
||||||
@ -50,12 +50,10 @@ void opcode_test_suite_t::load() {
|
|||||||
#ifdef USE_JSONCPP_JSON
|
#ifdef USE_JSONCPP_JSON
|
||||||
|
|
||||||
void opcode_test_suite_t::load() {
|
void opcode_test_suite_t::load() {
|
||||||
if (m_reader == nullptr) {
|
if (m_parser == nullptr)
|
||||||
Json::CharReaderBuilder builder;
|
m_parser.reset(Json::CharReaderBuilder().newCharReader());
|
||||||
m_reader.reset(builder.newCharReader());
|
|
||||||
}
|
|
||||||
const auto contents = read(path());
|
const auto contents = read(path());
|
||||||
if (!m_reader->parse(contents.data(), contents.data() + contents.size(), &m_raw, nullptr))
|
if (!m_parser->parse(contents.data(), contents.data() + contents.size(), &m_raw, nullptr))
|
||||||
throw std::runtime_error("Unable to parse tests");
|
throw std::runtime_error("Unable to parse tests");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
class opcode_test_suite_t final {
|
class opcode_test_suite_t final {
|
||||||
private:
|
private:
|
||||||
#ifdef USE_JSONCPP_JSON
|
#ifdef USE_JSONCPP_JSON
|
||||||
static std::unique_ptr<Json::CharReader> m_reader;
|
static std::unique_ptr<Json::CharReader> m_parser;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_SIMDJSON_JSON
|
#ifdef USE_SIMDJSON_JSON
|
||||||
static std::unique_ptr<simdjson::dom::parser> m_parser;
|
static std::unique_ptr<simdjson::dom::parser> m_parser;
|
||||||
|
@ -123,12 +123,12 @@ void state_t::initialise(const simdjson::dom::element serialised) {
|
|||||||
|
|
||||||
assert(!initialised());
|
assert(!initialised());
|
||||||
|
|
||||||
m_pc = (uint64_t)serialised["pc"];
|
m_pc = (uint16_t)(uint64_t)serialised["pc"];
|
||||||
m_s = (uint64_t)serialised["s"];
|
m_s = (uint8_t)(uint64_t)serialised["s"];
|
||||||
m_a = (uint64_t)serialised["a"];
|
m_a = (uint8_t)(uint64_t)serialised["a"];
|
||||||
m_x = (uint64_t)serialised["x"];
|
m_x = (uint8_t)(uint64_t)serialised["x"];
|
||||||
m_y = (uint64_t)serialised["y"];
|
m_y = (uint8_t)(uint64_t)serialised["y"];
|
||||||
m_p = (uint64_t)serialised["p"];
|
m_p = (uint8_t)(uint64_t)serialised["p"];
|
||||||
|
|
||||||
const auto ram_entries = serialised["ram"];
|
const auto ram_entries = serialised["ram"];
|
||||||
assert(ram_entries.is_array());
|
assert(ram_entries.is_array());
|
||||||
@ -138,7 +138,7 @@ void state_t::initialise(const simdjson::dom::element serialised) {
|
|||||||
assert(ram_entry_array.size() == 2);
|
assert(ram_entry_array.size() == 2);
|
||||||
const auto address = (uint64_t)ram_entry_array.at(0);
|
const auto address = (uint64_t)ram_entry_array.at(0);
|
||||||
const auto value = (uint64_t)ram_entry_array.at(1);
|
const auto value = (uint64_t)ram_entry_array.at(1);
|
||||||
m_ram[address] = value;
|
m_ram[(uint16_t)address] = (uint8_t)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_initialised = true;
|
m_initialised = true;
|
||||||
|
@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
//#define TEST_JSON_PERFORMANCE
|
//#define TEST_JSON_PERFORMANCE
|
||||||
|
|
||||||
|
#define USE_SIMDJSON_JSON // 15 seconds
|
||||||
//#define USE_BOOST_JSON // 32 seconds
|
//#define USE_BOOST_JSON // 32 seconds
|
||||||
//#define USE_NLOHMANN_JSON // 58 seconds
|
//#define USE_NLOHMANN_JSON // 58 seconds
|
||||||
//#define USE_JSONCPP_JSON // 88 seconds
|
//#define USE_JSONCPP_JSON // 88 seconds
|
||||||
#define USE_SIMDJSON_JSON // 15 seconds
|
|
||||||
|
|
||||||
#ifdef USE_BOOST_JSON
|
#ifdef USE_BOOST_JSON
|
||||||
# include <boost/json.hpp>
|
# include <boost/json.hpp>
|
||||||
|
@ -124,8 +124,8 @@ void test_t::initialise(const simdjson::dom::element serialised) {
|
|||||||
for (const auto cycles_entry : cycles_array) {
|
for (const auto cycles_entry : cycles_array) {
|
||||||
const auto cycle_array = cycles_entry.get_array();
|
const auto cycle_array = cycles_entry.get_array();
|
||||||
assert(cycle_array.size() == 3);
|
assert(cycle_array.size() == 3);
|
||||||
const auto address = (uint64_t)cycle_array.at(0);
|
const auto address = (uint16_t)(uint64_t)cycle_array.at(0);
|
||||||
const auto contents = (uint64_t)cycle_array.at(1);
|
const auto contents = (uint8_t)(uint64_t)cycle_array.at(1);
|
||||||
const auto action = to_action((std::string)cycle_array.at(2));
|
const auto action = to_action((std::string)cycle_array.at(2));
|
||||||
m_cycles.push_back({ address, contents, action });
|
m_cycles.push_back({ address, contents, action });
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user