mirror of
https://github.com/crskycode/GARbro.git
synced 2026-06-10 07:38:58 +08:00
(Binary.CopyOverlapped): use Buffer.BlockCopy when destination precedes source.
This commit is contained in:
@@ -74,14 +74,21 @@ namespace GameRes.Utility
|
||||
public static void CopyOverlapped (byte[] data, int src, int dst, int count)
|
||||
{
|
||||
int preceding = dst-src;
|
||||
while (count > 0)
|
||||
if (preceding > 0)
|
||||
{
|
||||
if (preceding > count)
|
||||
preceding = count;
|
||||
System.Buffer.BlockCopy (data, src, data, dst, preceding);
|
||||
src = dst;
|
||||
dst += preceding;
|
||||
count -= preceding;
|
||||
while (count > 0)
|
||||
{
|
||||
if (preceding > count)
|
||||
preceding = count;
|
||||
System.Buffer.BlockCopy (data, src, data, dst, preceding);
|
||||
src = dst;
|
||||
dst += preceding;
|
||||
count -= preceding;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
System.Buffer.BlockCopy (data, src, data, dst, count);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user