diff --git a/src/emu/emumem.h b/src/emu/emumem.h index ee8df52f3c8..83908baa1f4 100644 --- a/src/emu/emumem.h +++ b/src/emu/emumem.h @@ -131,8 +131,8 @@ template= 0 ? NATIVE_BYTES << iabs(AddrShift) : NATIVE_BYTES >> iabs(AddrShift); + constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0; // equal to native size and aligned; simple pass-through to the native reader if (NATIVE_BYTES == TARGET_BYTES && (Aligned || (address & NATIVE_MASK) == 0)) @@ -264,8 +264,8 @@ template= 0 ? NATIVE_BYTES << iabs(AddrShift) : NATIVE_BYTES >> iabs(AddrShift); + constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0; // equal to native size and aligned; simple pass-through to the native writer if (NATIVE_BYTES == TARGET_BYTES && (Aligned || (address & NATIVE_MASK) == 0)) @@ -388,7 +388,7 @@ template class memory_access_cache friend class address_table; using NativeType = typename handler_entry_size::uX; static constexpr u32 NATIVE_BYTES = 1 << Width; - static constexpr u32 NATIVE_MASK = NATIVE_BYTES - 1; + static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0; public: using cache_update_delegate = delegate &, offs_t)>;