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/srtc.cpp | |
parent | f0fab191e48f165c551980d724bba2f26a764795 (diff) | |
download | snes9x2005-f385752705de73b04cbbda735a71f14c19e241a6.tar.gz snes9x2005-f385752705de73b04cbbda735a71f14c19e241a6.tar.bz2 snes9x2005-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/srtc.cpp')
-rw-r--r-- | source/srtc.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/srtc.cpp b/source/srtc.cpp index 48add97..0e6f30e 100644 --- a/source/srtc.cpp +++ b/source/srtc.cpp @@ -525,12 +525,14 @@ void S9xSRTCPreSaveState () SRAM [s + 0] = rtc.needs_init; SRAM [s + 1] = rtc.count_enable; - memmove (&SRAM [s + 2], rtc.data, MAX_RTC_INDEX + 1); + // memmove converted: Different mallocs [Neb] + memcpy (&SRAM [s + 2], rtc.data, MAX_RTC_INDEX + 1); SRAM [s + 3 + MAX_RTC_INDEX] = rtc.index; SRAM [s + 4 + MAX_RTC_INDEX] = rtc.mode; #ifdef LSB_FIRST - memmove (&SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8); + // memmove converted: Different mallocs [Neb] + memcpy (&SRAM [s + 5 + MAX_RTC_INDEX], &rtc.system_timestamp, 8); #else SRAM [s + 5 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 0); SRAM [s + 6 + MAX_RTC_INDEX] = (uint8) (rtc.system_timestamp >> 8); @@ -555,12 +557,14 @@ void S9xSRTCPostLoadState () rtc.needs_init = SRAM [s + 0]; rtc.count_enable = SRAM [s + 1]; - memmove (rtc.data, &SRAM [s + 2], MAX_RTC_INDEX + 1); + // memmove converted: Different mallocs [Neb] + memcpy (rtc.data, &SRAM [s + 2], MAX_RTC_INDEX + 1); rtc.index = SRAM [s + 3 + MAX_RTC_INDEX]; rtc.mode = SRAM [s + 4 + MAX_RTC_INDEX]; #ifdef LSB_FIRST - memmove (&rtc.system_timestamp, &SRAM [s + 5 + MAX_RTC_INDEX], 8); + // memmove converted: Different mallocs [Neb] + memcpy (&rtc.system_timestamp, &SRAM [s + 5 + MAX_RTC_INDEX], 8); #else rtc.system_timestamp |= (SRAM [s + 5 + MAX_RTC_INDEX] << 0); rtc.system_timestamp |= (SRAM [s + 6 + MAX_RTC_INDEX] << 8); |