Prefer passing byte_t by value.

Signed-off-by: Adrian Conlon <adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon 2021-10-19 11:44:58 +01:00
parent 16752474d9
commit bb7de9d3e1
4 changed files with 9 additions and 9 deletions

View File

@ -130,7 +130,7 @@ void TestRunner::initialiseState() {
CPU().Y() = starting.y(); CPU().Y() = starting.y();
CPU().P() = starting.p(); CPU().P() = starting.p();
const auto& ram = starting.ram(); const auto& ram = starting.ram();
for (const auto& entry : ram) for (auto entry : ram)
RAM().poke(entry.address(), entry.value()); RAM().poke(entry.address(), entry.value());
m_actualCycles.clear(); m_actualCycles.clear();
@ -163,7 +163,7 @@ bool TestRunner::checkState() {
const auto& ram = finished.ram(); const auto& ram = finished.ram();
bool ram_problem = false; 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())); const auto ram_good = check("RAM", entry.address(), entry.value(), RAM().peek(entry.address()));
if (!ram_good && !ram_problem) if (!ram_good && !ram_problem)
ram_problem = true; ram_problem = true;

View File

@ -1,7 +1,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "ram_t.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)); assert(m_bytes.capacity() >= (m_bytes.size() + 1));
m_bytes.push_back(byte); 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) { ram_t::ram_t(simdjson::dom::array input) {
assert(m_bytes.empty()); assert(m_bytes.empty());
m_bytes.reserve(input.size()); m_bytes.reserve(input.size());
for (const auto& entry : input) for (auto entry : input)
add(entry); add(entry);
} }

View File

@ -52,7 +52,7 @@ public:
ram_t(const Json::Value& input); ram_t(const Json::Value& input);
#endif #endif
void add(const byte_t& byte); void add(byte_t byte);
[[nodiscard]] auto begin() const noexcept { return m_bytes.begin(); } [[nodiscard]] auto begin() const noexcept { return m_bytes.begin(); }
[[nodiscard]] auto end() const noexcept { return m_bytes.end(); } [[nodiscard]] auto end() const noexcept { return m_bytes.end(); }
@ -62,5 +62,5 @@ public:
void clear() noexcept { m_bytes.clear(); } void clear() noexcept { m_bytes.clear(); }
[[nodiscard]] auto& operator[](size_t idx) noexcept { return m_bytes[idx]; } [[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]; }
}; };

View File

@ -13,10 +13,10 @@
//#define TEST_JSON_PERFORMANCE //#define TEST_JSON_PERFORMANCE
#define USE_SIMDJSON_JSON // 13 seconds (24) #define USE_SIMDJSON_JSON // 13 seconds (19)
//#define USE_RAPIDJSON_JSON // 19 seconds (32) //#define USE_RAPIDJSON_JSON // 19 seconds (22)
//#define USE_BOOST_JSON // 26 seconds (32) //#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) //#define USE_JSONCPP_JSON // 80 seconds (91)
#ifdef USE_SIMDJSON_JSON #ifdef USE_SIMDJSON_JSON