fix(core): Cleans up networking (#386)
- [X] Deletes some unused networking code.
This commit is contained in:
parent
3dd0d8f42b
commit
126b80f74b
2 changed files with 0 additions and 94 deletions
|
|
@ -61,70 +61,6 @@ namespace Server.Network
|
|||
0x4, 0x00D
|
||||
};
|
||||
|
||||
public static void Compress(ref CircularBuffer<byte> buffer, ref int length)
|
||||
{
|
||||
length = Compress(ref buffer, length, ref buffer);
|
||||
}
|
||||
|
||||
public static int Compress(ref CircularBuffer<byte> input, int inputLength, ref CircularBuffer<byte> output)
|
||||
{
|
||||
if (inputLength > DefiniteOverflow)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int bitCount = 0;
|
||||
int bitValue = 0;
|
||||
|
||||
int inputIdx = 0;
|
||||
int outputIdx = 0;
|
||||
|
||||
while (inputIdx < inputLength)
|
||||
{
|
||||
int i = input[inputIdx++] << 1;
|
||||
|
||||
bitCount += _huffmanTable[i];
|
||||
bitValue = (bitValue << _huffmanTable[i]) | _huffmanTable[i + 1];
|
||||
|
||||
while (bitCount >= 8)
|
||||
{
|
||||
bitCount -= 8;
|
||||
|
||||
if (output.Length < outputIdx + 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
output[outputIdx++] = (byte)(bitValue >> bitCount);
|
||||
}
|
||||
}
|
||||
|
||||
// terminal code
|
||||
bitCount += _huffmanTable[0x200];
|
||||
bitValue = (bitValue << _huffmanTable[0x200]) | _huffmanTable[0x201];
|
||||
|
||||
// align on byte boundary
|
||||
if ((bitCount & 7) != 0)
|
||||
{
|
||||
bitValue <<= 8 - (bitCount & 7);
|
||||
bitCount += 8 - (bitCount & 7);
|
||||
}
|
||||
|
||||
while (bitCount >= 8)
|
||||
{
|
||||
bitCount -= 8;
|
||||
|
||||
if (output.Length < outputIdx + 1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
output[outputIdx++] = (byte)(bitValue >> bitCount);
|
||||
}
|
||||
|
||||
return outputIdx;
|
||||
}
|
||||
|
||||
public static void Compress(ReadOnlySpan<byte> input, ref CircularBuffer<byte> output, out int length)
|
||||
{
|
||||
length = Compress(input, ref output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue