From ca59125ef67f6e8c7fdedc9780b9c3c69b07f933 Mon Sep 17 00:00:00 2001 From: ikpil Date: Sun, 1 Oct 2023 18:47:54 +0900 Subject: [PATCH] bugfix: offset --- src/DotFastLZ.Compression/FastLZ.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DotFastLZ.Compression/FastLZ.cs b/src/DotFastLZ.Compression/FastLZ.cs index c1c7f3a..73b57f2 100644 --- a/src/DotFastLZ.Compression/FastLZ.cs +++ b/src/DotFastLZ.Compression/FastLZ.cs @@ -256,7 +256,7 @@ public static long CompressLevel2(byte[] input, long inputOffset, long length, b op = Literals(copy, input, anchor, output, op); /* marker for fastlz2 */ - output[0] |= (1 << 5); + output[inputOffset] |= (1 << 5); return op; } @@ -285,7 +285,7 @@ public static long Decompress(byte[] input, long length, byte[] output, long max public static long Decompress(byte[] input, long inputOffset, long length, byte[] output, long outputOffset, long maxout) { /* magic identifier for compression level */ - int level = (input[0] >> 5) + 1; + int level = (input[inputOffset] >> 5) + 1; if (level == 1) return DecompressLevel1(input, inputOffset, length, output, outputOffset, maxout); if (level == 2) return DecompressLevel2(input, inputOffset, length, output, outputOffset, maxout);