mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Avoid iterating twice in ReadData()
This commit is contained in:
parent
06714423a3
commit
9eeb052bb7
1 changed files with 2 additions and 2 deletions
|
|
@ -36,9 +36,9 @@ namespace MinecraftClient.Protocol.Handlers
|
||||||
/// <returns>The data read from the cache as an array</returns>
|
/// <returns>The data read from the cache as an array</returns>
|
||||||
public byte[] ReadData(int offset, Queue<byte> cache)
|
public byte[] ReadData(int offset, Queue<byte> cache)
|
||||||
{
|
{
|
||||||
byte[] result = cache.Take(offset).ToArray();
|
byte[] result = new byte[offset];
|
||||||
for (int i = 0; i < offset; i++)
|
for (int i = 0; i < offset; i++)
|
||||||
cache.Dequeue();
|
result[i] = cache.Dequeue();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue