Core: using if constexpr
C++17 optimization
This commit is contained in:
parent
30b0f83e21
commit
8d5af48efd
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue