Skip to content

Commit

Permalink
Use default compressor for rsizetable
Browse files Browse the repository at this point in the history
  • Loading branch information
ArchLeaders committed Jun 9, 2023
1 parent e166d9f commit cedb4fe
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Helpers/ZStdHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ namespace Totk.ZStdTool.Helpers;

public class ZStdHelper
{
private static readonly Decompressor _defaultDecompressor = new();
private static readonly Decompressor _commonDecompressor = new();
private static readonly Decompressor _mapDecompressor = new();
private static readonly Decompressor _packDecompressor = new();
private static readonly Compressor _defaultCompressor = new(16);
private static readonly Compressor _commonCompressor = new(16);
private static readonly Compressor _mapCompressor = new(16);
private static readonly Compressor _packCompressor = new(16);
Expand All @@ -32,6 +34,7 @@ public static Span<byte> Decompress(string file)
return
file.EndsWith(".bcett.byml.zs") ? _mapDecompressor.Unwrap(src) :
file.EndsWith(".pack.zs") ? _packDecompressor.Unwrap(src) :
file.EndsWith(".rsizetable.zs") ? _defaultDecompressor.Unwrap(src) :
_commonDecompressor.Unwrap(src);
}
public static Span<byte> Compress(string file)
Expand All @@ -40,6 +43,7 @@ public static Span<byte> Compress(string file)
return
file.EndsWith(".bcett.byml") ? _mapCompressor.Wrap(src) :
file.EndsWith(".pack") ? _packCompressor.Wrap(src) :
file.EndsWith(".rsizetable") ? _defaultCompressor.Wrap(src) :
_commonCompressor.Wrap(src);
}

Expand Down

0 comments on commit cedb4fe

Please sign in to comment.