mirror of
https://github.com/crskycode/GARbro.git
synced 2026-07-08 01:30:18 +08:00
(CopyOverlapped): slightly optimized BlockCopy loop.
This commit is contained in:
@@ -73,15 +73,12 @@ namespace GameRes.Utility
|
|||||||
|
|
||||||
public static void CopyOverlapped (byte[] data, int src, int dst, int count)
|
public static void CopyOverlapped (byte[] data, int src, int dst, int count)
|
||||||
{
|
{
|
||||||
int preceding = dst-src;
|
if (dst > src)
|
||||||
if (preceding > 0)
|
|
||||||
{
|
{
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
if (preceding > count)
|
int preceding = System.Math.Min (dst - src, count);
|
||||||
preceding = count;
|
|
||||||
System.Buffer.BlockCopy (data, src, data, dst, preceding);
|
System.Buffer.BlockCopy (data, src, data, dst, preceding);
|
||||||
src = dst;
|
|
||||||
dst += preceding;
|
dst += preceding;
|
||||||
count -= preceding;
|
count -= preceding;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user