mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-09-25 08:24:58 +00:00
stackalloc readtables
This commit is contained in:
@@ -866,9 +866,9 @@ internal sealed partial class Unpack : BitInput, IRarUnpack, IDisposable
|
||||
|
||||
private bool ReadTables()
|
||||
{
|
||||
var bitLength = new byte[PackDef.BC];
|
||||
Span<byte> bitLength = stackalloc byte[PackDef.BC];
|
||||
Span<byte> table = stackalloc byte[PackDef.HUFF_TABLE_SIZE];
|
||||
|
||||
var table = new byte[PackDef.HUFF_TABLE_SIZE];
|
||||
if (inAddr > readTop - 25)
|
||||
{
|
||||
if (!unpReadBuf())
|
||||
@@ -996,7 +996,7 @@ internal sealed partial class Unpack : BitInput, IRarUnpack, IDisposable
|
||||
|
||||
// memcpy(unpOldTable,table,sizeof(unpOldTable));
|
||||
|
||||
Buffer.BlockCopy(table, 0, unpOldTable, 0, unpOldTable.Length);
|
||||
table.CopyTo(unpOldTable);
|
||||
return (true);
|
||||
}
|
||||
|
||||
|
||||
@@ -391,11 +391,9 @@ internal partial class Unpack
|
||||
|
||||
private bool ReadTables20()
|
||||
{
|
||||
var BitLength = new byte[PackDef.BC20];
|
||||
var Table = new byte[PackDef.MC20 * 4];
|
||||
int TableSize,
|
||||
N,
|
||||
I;
|
||||
Span<byte> BitLength = stackalloc byte[PackDef.BC20];
|
||||
Span<byte> Table = stackalloc byte[PackDef.MC20 * 4];
|
||||
int TableSize, N, I;
|
||||
if (inAddr > readTop - 25)
|
||||
{
|
||||
if (!unpReadBuf())
|
||||
|
||||
@@ -181,13 +181,12 @@ internal static class UnpackUtility
|
||||
return (dec.DecodeNum[N]);
|
||||
}
|
||||
|
||||
internal static void makeDecodeTables(byte[] lenTab, int offset, Decode.Decode dec, int size)
|
||||
internal static void makeDecodeTables(Span<byte> lenTab, int offset, Decode.Decode dec, int size)
|
||||
{
|
||||
Span<int> lenCount = stackalloc int[16];
|
||||
Span<int> tmpPos = stackalloc int[16];
|
||||
int i;
|
||||
long M,
|
||||
N;
|
||||
long M, N;
|
||||
|
||||
new Span<int>(dec.DecodeNum).Clear(); // memset(Dec->DecodeNum,0,Size*sizeof(*Dec->DecodeNum));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user