diff options
author | bunnei <bunneidev@gmail.com> | 2014-08-18 02:30:30 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2014-08-18 02:30:30 +0200 |
commit | 7ed73af78fb1b8e736b7807633875b3fe05474e6 (patch) | |
tree | 6ab8ab1f459d87da940fb9551ed152402a7c1976 | |
parent | Merge pull request #54 from lioncash/fmt (diff) | |
parent | Core: Fix undefined behavior in mem_map_funcs' WriteBlock function (diff) | |
download | yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.tar yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.tar.gz yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.tar.bz2 yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.tar.lz yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.tar.xz yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.tar.zst yuzu-7ed73af78fb1b8e736b7807633875b3fe05474e6.zip |
-rw-r--r-- | src/core/mem_map_funcs.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp index 5772cca52..ecdaa06d7 100644 --- a/src/core/mem_map_funcs.cpp +++ b/src/core/mem_map_funcs.cpp @@ -289,11 +289,15 @@ void Write64(const u32 addr, const u64 data) { void WriteBlock(const u32 addr, const u8* data, const int size) { int offset = 0; - while (offset < (size & ~3)) - Write32(addr + offset, *(u32*)&data[offset += 4]); + while (offset < (size & ~3)) { + Write32(addr + offset, *(u32*)&data[offset]); + offset += 4; + } - if (size & 2) - Write16(addr + offset, *(u16*)&data[offset += 2]); + if (size & 2) { + Write16(addr + offset, *(u16*)&data[offset]); + offset += 2; + } if (size & 1) Write8(addr + offset, data[offset]); |