mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-13 03:30:31 +00:00
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:
parent
a5a5410515
commit
9ed1a118e6
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user