diff options
author | Nebuleon Fumika | 2013-02-01 00:33:30 -0500 |
---|---|---|
committer | Nebuleon Fumika | 2013-02-01 00:33:30 -0500 |
commit | f385752705de73b04cbbda735a71f14c19e241a6 (patch) | |
tree | 59aca906a8c3fcbaae402d503e7c6b34643e0199 /source/sa1.cpp | |
parent | f0fab191e48f165c551980d724bba2f26a764795 (diff) | |
download | snesemu-f385752705de73b04cbbda735a71f14c19e241a6.tar.gz snesemu-f385752705de73b04cbbda735a71f14c19e241a6.tar.bz2 snesemu-f385752705de73b04cbbda735a71f14c19e241a6.zip |
memcpy vs memmove: memmove correctly handles overlapping source and destination memory buffers, but is slower than memcpy in many implementations. When memory buffers don't overlap, memcpy may be more efficient.
The DS2 SDK is such an implementation, so change many memmoves into memcpys.
Diffstat (limited to 'source/sa1.cpp')
-rw-r--r-- | source/sa1.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/sa1.cpp b/source/sa1.cpp index 4dbf9b0..addeed7 100644 --- a/source/sa1.cpp +++ b/source/sa1.cpp @@ -742,7 +742,8 @@ void S9xSetSA1 (uint8 byte, uint32 address) if ((Memory.FillRAM [0x2230] & 0xb0) == 0xa0) { // Char conversion 2 DMA enabled - memmove (&Memory.ROM [CMemory::MAX_ROM_SIZE - 0x10000] + SA1.in_char_dma * 16, + // memmove converted: Same malloc but constant non-overlapping addresses [Neb] + memcpy (&Memory.ROM [CMemory::MAX_ROM_SIZE - 0x10000] + SA1.in_char_dma * 16, &Memory.FillRAM [0x2240], 16); SA1.in_char_dma = (SA1.in_char_dma + 1) & 7; if ((SA1.in_char_dma & 3) == 0) @@ -895,6 +896,7 @@ static void S9xSA1DMA () len &= 0x3ff; d = &Memory.FillRAM [0x3000] + dst; } + // memmove required: Can overlap arbitrarily [Neb] memmove (d, s, len); Memory.FillRAM [0x2301] |= 0x20; |