From f385752705de73b04cbbda735a71f14c19e241a6 Mon Sep 17 00:00:00 2001 From: Nebuleon Fumika Date: Fri, 1 Feb 2013 00:33:30 -0500 Subject: 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. --- source/clip.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/clip.cpp') diff --git a/source/clip.cpp b/source/clip.cpp index 57204ac..7147abf 100644 --- a/source/clip.cpp +++ b/source/clip.cpp @@ -291,7 +291,8 @@ void ComputeClipWindows () if (BAND_EMPTY(Win1[0])) { B = Window2Enabled; - memmove (Bands, Win2, + // memmove converted: Different stack allocations [Neb] + memcpy (Bands, Win2, sizeof(Win2[0]) * Window2Enabled); } else @@ -355,7 +356,8 @@ void ComputeClipWindows () // use window 1 as the clipping (which // could also be empty). B = Window1Enabled; - memmove (Bands, Win1, + // memmove converted: Different stack allocations [Neb] + memcpy (Bands, Win1, sizeof(Win1[0]) * Window1Enabled); } else @@ -468,14 +470,16 @@ void ComputeClipWindows () if (Window1Enabled == 1 && BAND_EMPTY(Win1[0])) { B = Window2Enabled; - memmove (Bands, Win2, + // memmove converted: Different stack allocations [Neb] + memcpy (Bands, Win2, sizeof(Win2[0]) * Window2Enabled); } else if (Window2Enabled == 1 && BAND_EMPTY(Win2[0])) { B = Window1Enabled; - memmove (Bands, Win1, + // memmove converted: Different stack allocations [Neb] + memcpy (Bands, Win1, sizeof(Win1[0]) * Window1Enabled); } else -- cgit v1.2.3