Implement bit flipping with a lookup table

Should improve performance.
This version is cooler, and also does not suffer from iteration limits
This commit is contained in:
ISSOtm
2022-05-21 12:57:46 +02:00
committed by Eldred Habert
parent b4dadd35b6
commit 7a7126f3b8
3 changed files with 19 additions and 11 deletions

View File

@@ -271,8 +271,8 @@ void reverse() {
uint8_t realY = attribute & 0x40 ? 7 - y : y;
uint8_t bitplane0 = tileData[realY * 2], bitplane1 = tileData[realY * 2 + 1];
if (attribute & 0x20) { // Handle horizontal flip
bitplane0 = flip(bitplane0);
bitplane1 = flip(bitplane1);
bitplane0 = flipTable[bitplane0];
bitplane1 = flipTable[bitplane1];
}
uint8_t *ptr = &rowPtrs[y][tx * 8 * SIZEOF_PIXEL];
for (uint8_t x = 0; x < 8; ++x) {