Couple of small reference changes

This commit is contained in:
Adrian Conlon 2023-05-17 12:47:57 +01:00
parent 9e2c3e32b1
commit fd36555585
5 changed files with 14 additions and 17 deletions

View File

@ -10,13 +10,12 @@ Fuse::TestSuite::TestSuite(std::string path) {
void Fuse::TestSuite::run() {
auto failedCount = 0;
auto unimplementedCount = 0;
for (auto test : m_tests.container()) {
for (const auto& test : m_tests.container()) {
auto key = test.first;
const auto& [key, input] = test;
std::cout << "** Checking: " << key << std::endl;
auto input = test.second;
auto result = m_results.container().find(key)->second;
const auto& result = m_results.container().find(key)->second;
Fuse::TestRunner runner(input, result);

View File

@ -42,9 +42,8 @@ void EightBit::Profiler::EmitProfileInformation() {
{
StartingScopeOutput.fire();
for (auto& scopeCycle : scopeCycles) {
auto name = scopeCycle.first;
auto cycles = scopeCycle.second;
for (const auto& scopeCycle : scopeCycles) {
const auto& [name, cycles] = scopeCycle;
auto namedAddress = (size_t)symbols.addresses().find(name)->second;
auto count = addressCounts[namedAddress];
ProfileScopeEventArgs event(name, cycles, count);
@ -72,9 +71,8 @@ void EightBit::Profiler::addAddress(uint16_t address, int cycles) {
}
void EightBit::Profiler::BuildAddressScopes() {
for (auto& label : symbols.labels()) {
auto address = label.first;
auto key = label.second;
for (const auto& label : symbols.labels()) {
const auto& [address, key] = label;
auto scope = symbols.scopes().find(key);
if (scope != symbols.scopes().end()) {
for (uint16_t i = address; i < address + scope->second; ++i) {

View File

@ -10,12 +10,11 @@ Fuse::TestSuite::TestSuite(std::string path) {
void Fuse::TestSuite::run() {
auto failedCount = 0;
auto unimplementedCount = 0;
for (auto test : m_tests.container()) {
for (const auto& test : m_tests.container()) {
auto key = test.first;
const auto& [key, input] = test;
std::cout << "** Checking: " << key << std::endl;
auto input = test.second;
auto result = m_results.container().find(key)->second;
Fuse::TestRunner runner(input, result);

View File

@ -30,8 +30,7 @@ void EightBit::Bus::loadHexFile(const std::string path) {
IntelHexFile file(path);
const auto chunks = file.parse();
for (const auto& chunk : chunks) {
const auto address = chunk.first;
const auto content = chunk.second;
const auto& [address, content] = chunk;
const auto mapped = mapping(address);
const uint16_t offset = address - mapped.begin;
mapped.memory.load(content, offset);

View File

@ -18,8 +18,10 @@ std::map<uint16_t, std::vector<uint8_t>> EightBit::IntelHexFile::parse() {
std::getline(m_file, line);
const auto parsed = parse(line);
if (parsed.has_value())
returned[parsed.value().first] = parsed.value().second;
if (parsed.has_value()) {
const auto& [address, content] = parsed.value();
returned[address] = content;
}
}
if (!m_eof)