Core: using if constexpr C++17 optimization

This commit is contained in:
Герман Семенов 2023-03-27 01:52:57 +03:00 committed by Henrik Rydgård
parent 30b0f83e21
commit 8d5af48efd

View file

@ -87,13 +87,13 @@ u32 RunValidateAddress(u32 pc, u32 addr, u32 isWrite) {
if (!Memory::IsValidRange(addr, alignment)) {
MemoryExceptionType t = isWrite == 1 ? MemoryExceptionType::WRITE_WORD : MemoryExceptionType::READ_WORD;
if (alignment > 4)
if constexpr (alignment > 4)
t = isWrite ? MemoryExceptionType::WRITE_BLOCK : MemoryExceptionType::READ_BLOCK;
return toss(t);
}
if (alignment > 1 && (addr & (alignment - 1)) != 0) {
return toss(MemoryExceptionType::ALIGNMENT);
}
if constexpr (alignment > 1)
if ((addr & (alignment - 1)) != 0)
return toss(MemoryExceptionType::ALIGNMENT);
return 0;
}