Sort a bunch of missing argument const specifications.

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2018-09-21 00:16:00 +01:00
parent 9e91d2adad
commit 7adefd380a
11 changed files with 73 additions and 69 deletions
+2 -2
View File
@@ -17,14 +17,14 @@ void EightBit::BigEndianProcessor::setWord(const register16_t value) {
BUS().write(value.low);
}
EightBit::register16_t EightBit::BigEndianProcessor::getWordPaged(uint8_t page, uint8_t offset) {
EightBit::register16_t EightBit::BigEndianProcessor::getWordPaged(const uint8_t page, const uint8_t offset) {
const auto high = getBytePaged(page, offset);
++BUS().ADDRESS().low;
const auto low = BUS().read();
return register16_t(low, high);
}
void EightBit::BigEndianProcessor::setWordPaged(uint8_t page, uint8_t offset, register16_t value) {
void EightBit::BigEndianProcessor::setWordPaged(const uint8_t page, const uint8_t offset, const register16_t value) {
setBytePaged(page, offset, value.high);
++BUS().ADDRESS().low;
BUS().read(value.low);
+1 -1
View File
@@ -88,7 +88,7 @@ std::map<uint16_t, std::vector<uint8_t>> EightBit::Bus::parseHexFile(const std::
return returned;
}
uint8_t& EightBit::Bus::reference(uint16_t address) {
uint8_t& EightBit::Bus::reference(const uint16_t address) {
const auto mapped = mapping(address);
const uint16_t offset = address - mapped.begin;
if (mapped.access == MemoryMapping::ReadOnly)
+2 -2
View File
@@ -17,14 +17,14 @@ void EightBit::LittleEndianProcessor::setWord(const register16_t value) {
BUS().write(value.high);
}
EightBit::register16_t EightBit::LittleEndianProcessor::getWordPaged(uint8_t page, uint8_t offset) {
EightBit::register16_t EightBit::LittleEndianProcessor::getWordPaged(const uint8_t page, const uint8_t offset) {
const auto low = getBytePaged(page, offset);
++BUS().ADDRESS().low;
const auto high = BUS().read();
return register16_t(low, high);
}
void EightBit::LittleEndianProcessor::setWordPaged(uint8_t page, uint8_t offset, register16_t value) {
void EightBit::LittleEndianProcessor::setWordPaged(const uint8_t page, const uint8_t offset, const register16_t value) {
setBytePaged(page, offset, value.low);
++BUS().ADDRESS().low;
BUS().read(value.high);
+2 -2
View File
@@ -27,13 +27,13 @@ void EightBit::Processor::handleIRQ() {
int EightBit::Processor::run(const int limit) {
int current = 0;
while (LIKELY(powered()) && current < limit)
while (LIKELY(powered() && (current < limit)))
current += step();
return current;
}
// http://graphics.stanford.edu/~seander/bithacks.html#FixedSignExtend
int8_t EightBit::Processor::signExtend(int b, uint8_t x) {
int8_t EightBit::Processor::signExtend(const int b, uint8_t x) {
const uint8_t m = 1 << (b - 1); // mask can be pre-computed if b is fixed
x = x & ((1 << b) - 1); // (Skip this if bits in x above position b are already zero.)
const auto result = (x ^ m) - m;