ppcmmu: Check sizeof(T) explicitly.

I don't know if the compiler is smart enough to figure out that ((guest_va & 0xFFF) + sizeof(T)) > 0x1000) is always false when sizeof(T) == 1 so we'll add a check for sizeof(T) > 1.
This commit is contained in:
joevt 2024-03-20 01:38:28 -07:00 committed by dingusdev
parent a5a5410515
commit 9ed1a118e6
1 changed files with 2 additions and 2 deletions

View File

@ -1206,7 +1206,7 @@ static T read_unaligned(uint32_t guest_va, uint8_t *host_va)
T result = 0;
// is it a misaligned cross-page read?
if (((guest_va & 0xFFF) + sizeof(T)) > 0x1000) {
if ((sizeof(T) > 1) && ((guest_va & 0xFFF) + sizeof(T)) > 0x1000) {
#ifdef MMU_PROFILING
unaligned_crossp_r++;
#endif
@ -1249,7 +1249,7 @@ static void write_unaligned(uint32_t guest_va, uint8_t *host_va, T value)
}
// is it a misaligned cross-page write?
if (((guest_va & 0xFFF) + sizeof(T)) > 0x1000) {
if ((sizeof(T) > 1) && ((guest_va & 0xFFF) + sizeof(T)) > 0x1000) {
#ifdef MMU_PROFILING
unaligned_crossp_w++;
#endif