Tidying
This commit is contained in:
@@ -21,9 +21,8 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
|
|||||||
auto dataIt = data.begin();
|
auto dataIt = data.begin();
|
||||||
const auto dataEndIt = data.end();
|
const auto dataEndIt = data.end();
|
||||||
|
|
||||||
while(dataIt != dataEndIt) {
|
while (std::distance(dataIt, dataEndIt) >= 2) {
|
||||||
auto opcodeMatched = false;
|
auto opcodeMatched = false;
|
||||||
const auto wordAvailable = std::distance(dataIt, dataEndIt) >= 2;
|
|
||||||
|
|
||||||
for (const auto& decoder : decoders) {
|
for (const auto& decoder : decoders) {
|
||||||
auto instruction = decoder(dataIt, dataEndIt);
|
auto instruction = decoder(dataIt, dataEndIt);
|
||||||
@@ -43,18 +42,12 @@ namespace Targets::Microchip::Avr::Avr8Bit::OpcodeDecoder
|
|||||||
if (throwOnFailure) {
|
if (throwOnFailure) {
|
||||||
throw Exceptions::DecodeFailure(
|
throw Exceptions::DecodeFailure(
|
||||||
instructionByteAddress,
|
instructionByteAddress,
|
||||||
wordAvailable
|
static_cast<std::uint32_t>(*(dataIt + 1) << 8) | *dataIt
|
||||||
? static_cast<std::uint32_t>(*(dataIt + 1) << 8) | *dataIt
|
|
||||||
: *dataIt
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
output.insert(std::pair(instructionByteAddress, std::nullopt));
|
output.insert(std::pair(instructionByteAddress, std::nullopt));
|
||||||
|
|
||||||
if (!wordAvailable) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
dataIt += 2;
|
dataIt += 2;
|
||||||
instructionByteAddress += 2;
|
instructionByteAddress += 2;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user