mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-29 23:40:27 +00:00
Reverse array in place
This commit is contained in:
parent
858760fa28
commit
9c521919e5
1 changed files with 11 additions and 6 deletions
|
@ -62,12 +62,17 @@ namespace PKHeX.Core
|
|||
|
||||
private static byte[] Invert(byte[] data)
|
||||
{
|
||||
byte[] result = new byte[data.Length];
|
||||
int o = 0;
|
||||
int i = data.Length;
|
||||
while (o != data.Length)
|
||||
result[--i] = data[o++];
|
||||
return result;
|
||||
int i = 0;
|
||||
int j = 0 + data.Length - 1;
|
||||
while (i < j)
|
||||
{
|
||||
var temp = data[i];
|
||||
data[i] = data[j];
|
||||
data[j] = temp;
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue