Eliminate three allocations in HbMakeCodeLengths

This commit is contained in:
Jason Nelson
2020-07-31 16:33:00 -07:00
parent ae5635319b
commit 75a6db8f4c

View File

@@ -89,9 +89,9 @@ namespace SharpCompress.Compressors.BZip2
int nNodes, nHeap, n1, n2, i, j, k;
bool tooLong;
int[] heap = new int[BZip2Constants.MAX_ALPHA_SIZE + 2];
int[] weight = new int[BZip2Constants.MAX_ALPHA_SIZE * 2];
int[] parent = new int[BZip2Constants.MAX_ALPHA_SIZE * 2];
Span<int> heap = stackalloc int[BZip2Constants.MAX_ALPHA_SIZE + 2]; // 1040 bytes
Span<int> weight = stackalloc int[BZip2Constants.MAX_ALPHA_SIZE * 2]; // 1040 bytes
Span<int> parent = stackalloc int[BZip2Constants.MAX_ALPHA_SIZE * 2]; // 1040 bytes
for (i = 0; i < alphaSize; i++)
{