Optimisation: Prefer return by value to return by reference. ~10% speed-up!

Just watch a video by Chandler Carruth from 2015, where he talked about C++ optimisers...

Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
Adrian Conlon
2018-02-25 19:48:01 +00:00
parent d34b161255
commit adf506a41e
7 changed files with 48 additions and 46 deletions

View File

@@ -20,10 +20,12 @@ uint8_t EightBit::IntelProcessor::pop() {
return getByte(SP().word++);
}
void EightBit::IntelProcessor::getWord(register16_t& value) {
value.low = getByte(MEMPTR().word++);
EightBit::register16_t EightBit::IntelProcessor::getWord() {
register16_t returned;
returned.low = getByte(MEMPTR().word++);
BUS().ADDRESS().word++;
value.high = getByte();
returned.high = getByte();
return returned;
}
void EightBit::IntelProcessor::setWord(register16_t value) {