adding a define for fallthrough abstraction

This commit is contained in:
Clément Le Bihan
2021-05-21 00:41:11 +02:00
parent 3a06afa507
commit 11d0f35e07
3 changed files with 6 additions and 7 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ namespace ComSquare::PPU
secondLowByte = this->_vram->read((tileAddress + 17) % VRAMSIZE);
result = ((secondHighByte & (1U << shift)) | ((secondLowByte & (1U << shift)) << 1U));
result = (shift - 2 >= 0) ? result >> (shift - 2) : result << ((shift - 2) * -1);
__attribute__((fallthrough));
FALLTHROUGH
case 2:
result += ((highByte & (1U << shift)) | ((lowByte & (1U << shift)) << 1U)) >> shift;
default:
+3 -3
View File
@@ -300,7 +300,7 @@ namespace ComSquare::PPU
case PpuRegisters::bg1hofs:
// TODO need of special var for prev value for Mode 7
this->_registers._m7ofs[addr - PpuRegisters::bg1hofs].raw = data;
__attribute__((fallthrough));
FALLTHROUGH
case PpuRegisters::bg2hofs:
case PpuRegisters::bg3hofs:
case PpuRegisters::bg4hofs:
@@ -311,7 +311,7 @@ namespace ComSquare::PPU
case PpuRegisters::bg1vofs:
// TODO need of special var for prev value for Mode 7
this->_registers._bgnba[addr - PpuRegisters::bg12nba].raw = data;
__attribute__((fallthrough));
FALLTHROUGH
case PpuRegisters::bg2vofs:
case PpuRegisters::bg3vofs:
case PpuRegisters::bg4vofs:
@@ -665,7 +665,7 @@ namespace ComSquare::PPU
return 8;
return 7;
default:
return -1;
throw std::runtime_error("Invalid Background number");
}
}
+2 -3
View File
@@ -14,10 +14,9 @@
#include "Background.hpp"
#include "PPUUtils.hpp"
//#define max2BitTiles 4096
//#define max4BitTiles 2048
//#define max8BitTiles 1024
#define FALLTHROUGH __attribute__((fallthrough));
// TODO check if it usefull to have defines instead of constepxr
#define VRAMSIZE 65536
#define CGRAMSIZE 512
#define OAMRAMSIZE 544