mirror of
https://github.com/PabloMK7/citra.git
synced 2024-11-20 14:34:17 +00:00
Merge pull request #53 from lioncash/memmap
Core: Fix undefined behavior in mem_map_funcs' WriteBlock function
This commit is contained in:
commit
7ed73af78f
1 changed files with 8 additions and 4 deletions
|
@ -289,11 +289,15 @@ void Write64(const u32 addr, const u64 data) {
|
||||||
|
|
||||||
void WriteBlock(const u32 addr, const u8* data, const int size) {
|
void WriteBlock(const u32 addr, const u8* data, const int size) {
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
while (offset < (size & ~3))
|
while (offset < (size & ~3)) {
|
||||||
Write32(addr + offset, *(u32*)&data[offset += 4]);
|
Write32(addr + offset, *(u32*)&data[offset]);
|
||||||
|
offset += 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (size & 2)
|
if (size & 2) {
|
||||||
Write16(addr + offset, *(u16*)&data[offset += 2]);
|
Write16(addr + offset, *(u16*)&data[offset]);
|
||||||
|
offset += 2;
|
||||||
|
}
|
||||||
|
|
||||||
if (size & 1)
|
if (size & 1)
|
||||||
Write8(addr + offset, data[offset]);
|
Write8(addr + offset, data[offset]);
|
||||||
|
|
Loading…
Reference in a new issue