Skip to content

Commit

Permalink
reverted back to slice (.NET 4.6 does not have Range)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloszKrajewski committed Oct 3, 2023
1 parent 1d3a3c9 commit 5c47ec3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/K4os.Compression.LZ4/LZ4Pickler.pickle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private static byte[] PickleWithBuffer(
var target = result.AsSpan();
var offset = EncodeUncompressedHeader(target, version, sourceLength);
Debug.Assert(headerSize == offset, "Unexpected header size");
source.CopyTo(target[offset..]);
source.CopyTo(target.Slice(offset));
return result;
}
else
Expand All @@ -100,7 +100,7 @@ private static byte[] PickleWithBuffer(
var offset = EncodeCompressedHeader(
target, version, headerSize, sourceLength, encodedLength);
Debug.Assert(headerSize == offset, "Unexpected header size");
buffer[..encodedLength].CopyTo(target[offset..]);
buffer.Slice(0, encodedLength).CopyTo(target.Slice(offset));
return result;
}
}
Expand Down Expand Up @@ -135,7 +135,7 @@ public static void Pickle<TBufferWriter>(
if (encodedLength <= 0 || encodedLength >= sourceLength)
{
var offset = EncodeUncompressedHeader(target, version, sourceLength);
source.CopyTo(target[offset..]);
source.CopyTo(target.Slice(offset));
writer.Advance(offset + sourceLength);
}
else
Expand Down Expand Up @@ -207,7 +207,7 @@ private static int EncodeCompressedHeaderV0(
var sizeOfDiff = headerSize - 1;
Debug.Assert(EffectiveSizeOf(diffLength) <= sizeOfDiff, "Unexpected header size");
target[0] = EncodeHeaderByteV0(sizeOfDiff);
PokeN(target[1..], diffLength, sizeOfDiff);
PokeN(target.Slice(1), diffLength, sizeOfDiff);
return 1 + sizeOfDiff;
}

Expand Down

0 comments on commit 5c47ec3

Please sign in to comment.