mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-27 15:44:00 +08:00
(Binary.CopyOverlapped): use Buffer.BlockCopy when destination precedes source.
This commit is contained in:
parent
4f86894f9f
commit
7853d6a462
@ -74,6 +74,8 @@ 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;
|
int preceding = dst-src;
|
||||||
|
if (preceding > 0)
|
||||||
|
{
|
||||||
while (count > 0)
|
while (count > 0)
|
||||||
{
|
{
|
||||||
if (preceding > count)
|
if (preceding > count)
|
||||||
@ -84,6 +86,11 @@ namespace GameRes.Utility
|
|||||||
count -= preceding;
|
count -= preceding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Buffer.BlockCopy (data, src, data, dst, count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string GetCString (byte[] data, int index, int length_limit, Encoding enc)
|
public static string GetCString (byte[] data, int index, int length_limit, Encoding enc)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user