From bb7de9d3e13dc09186196c42727c57a74180b1d9 Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Tue, 19 Oct 2021 11:44:58 +0100 Subject: [PATCH] Prefer passing byte_t by value. Signed-off-by: Adrian Conlon --- M6502/HarteTest_6502/TestRunner.cpp | 4 ++-- M6502/HarteTest_6502/ram_t.cpp | 4 ++-- M6502/HarteTest_6502/ram_t.h | 4 ++-- M6502/HarteTest_6502/stdafx.h | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/M6502/HarteTest_6502/TestRunner.cpp b/M6502/HarteTest_6502/TestRunner.cpp index c13c72f..6f5555f 100644 --- a/M6502/HarteTest_6502/TestRunner.cpp +++ b/M6502/HarteTest_6502/TestRunner.cpp @@ -130,7 +130,7 @@ void TestRunner::initialiseState() { CPU().Y() = starting.y(); CPU().P() = starting.p(); const auto& ram = starting.ram(); - for (const auto& entry : ram) + for (auto entry : ram) RAM().poke(entry.address(), entry.value()); m_actualCycles.clear(); @@ -163,7 +163,7 @@ bool TestRunner::checkState() { const auto& ram = finished.ram(); bool ram_problem = false; - for (const auto& entry : ram) { + for (auto entry : ram) { const auto ram_good = check("RAM", entry.address(), entry.value(), RAM().peek(entry.address())); if (!ram_good && !ram_problem) ram_problem = true; diff --git a/M6502/HarteTest_6502/ram_t.cpp b/M6502/HarteTest_6502/ram_t.cpp index bdbab50..5aaa62c 100644 --- a/M6502/HarteTest_6502/ram_t.cpp +++ b/M6502/HarteTest_6502/ram_t.cpp @@ -1,7 +1,7 @@ #include "stdafx.h" #include "ram_t.h" -void ram_t::add(const byte_t& byte) { +void ram_t::add(byte_t byte) { assert(m_bytes.capacity() >= (m_bytes.size() + 1)); m_bytes.push_back(byte); } @@ -11,7 +11,7 @@ void ram_t::add(const byte_t& byte) { ram_t::ram_t(simdjson::dom::array input) { assert(m_bytes.empty()); m_bytes.reserve(input.size()); - for (const auto& entry : input) + for (auto entry : input) add(entry); } diff --git a/M6502/HarteTest_6502/ram_t.h b/M6502/HarteTest_6502/ram_t.h index 6ae91f9..56a4ae9 100644 --- a/M6502/HarteTest_6502/ram_t.h +++ b/M6502/HarteTest_6502/ram_t.h @@ -52,7 +52,7 @@ public: ram_t(const Json::Value& input); #endif - void add(const byte_t& byte); + void add(byte_t byte); [[nodiscard]] auto begin() const noexcept { return m_bytes.begin(); } [[nodiscard]] auto end() const noexcept { return m_bytes.end(); } @@ -62,5 +62,5 @@ public: void clear() noexcept { m_bytes.clear(); } [[nodiscard]] auto& operator[](size_t idx) noexcept { return m_bytes[idx]; } - [[nodiscard]] const auto& operator[](size_t idx) const noexcept { return m_bytes[idx]; } + [[nodiscard]] auto operator[](size_t idx) const noexcept { return m_bytes[idx]; } }; diff --git a/M6502/HarteTest_6502/stdafx.h b/M6502/HarteTest_6502/stdafx.h index cc84e43..c4c3dff 100644 --- a/M6502/HarteTest_6502/stdafx.h +++ b/M6502/HarteTest_6502/stdafx.h @@ -13,10 +13,10 @@ //#define TEST_JSON_PERFORMANCE -#define USE_SIMDJSON_JSON // 13 seconds (24) -//#define USE_RAPIDJSON_JSON // 19 seconds (32) +#define USE_SIMDJSON_JSON // 13 seconds (19) +//#define USE_RAPIDJSON_JSON // 19 seconds (22) //#define USE_BOOST_JSON // 26 seconds (32) -//#define USE_NLOHMANN_JSON // 56 seconds (79) +//#define USE_NLOHMANN_JSON // 56 seconds (69) //#define USE_JSONCPP_JSON // 80 seconds (91) #ifdef USE_SIMDJSON_JSON