From 8387b00f4282a02429df073a8719e8ad12c65187 Mon Sep 17 00:00:00 2001 From: Michael Maltese Date: Fri, 24 Mar 2017 11:25:19 -0700 Subject: [PATCH] MMU: rewrite loop to avoid warning Fixes warning: ``` dolphin/Source/Core/Core/PowerPC/MMU.cpp:278:43: warning: shift count >= width of type [-Wshift-count-overflow] addr++, addr_translated++, val >>= 8) ``` --- Source/Core/Core/PowerPC/MMU.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/Core/Core/PowerPC/MMU.cpp b/Source/Core/Core/PowerPC/MMU.cpp index 31b0e7501f..557ae8746a 100644 --- a/Source/Core/Core/PowerPC/MMU.cpp +++ b/Source/Core/Core/PowerPC/MMU.cpp @@ -274,12 +274,11 @@ static void WriteToHardware(u32 em_address, const T data) } T val = bswap(data); u32 addr_translated = translated_addr.address; - for (u32 addr = em_address; addr < em_address + sizeof(T); - addr++, addr_translated++, val >>= 8) + for (size_t i = 0; i < sizeof(T); i++, addr_translated++) { - if (addr == em_address_next_page) + if (em_address + i == em_address_next_page) addr_translated = addr_next_page.address; - WriteToHardware(addr_translated, (u8)val); + WriteToHardware(addr_translated, static_cast(val >> (i * 8))); } return; }