Skip to content

Commit 6f8bb52

Browse files
committed
Release 5.16.1
1 parent eaf9902 commit 6f8bb52

File tree

27 files changed

+125
-61
lines changed

27 files changed

+125
-61
lines changed

CHANGELOG.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
11
Release Notes
22
====
33

4-
# 12-05-2024
5-
<a href="https://www.nuget.org/packages/dotnext/5.16.0">DotNext 5.16.0</a>
4+
# 12-07-2024
5+
<a href="https://www.nuget.org/packages/dotnext/5.16.0">DotNext 5.16.1</a>
66
* Added [LEB128](https://en.wikipedia.org/wiki/LEB128) encoder and decoder as a public API. See `DotNext.Buffers.Binary.Leb128<T>` type for more information
77
* Added `SlideToEnd` method to `SpanWriter<T>` type
88
* Added `IsBitSet` and `SetBit` generic methods to `Number` type
99
* Added `DetachOrCopyBuffer` to `BufferWriterSlim<T>` type
1010

11-
<a href="https://www.nuget.org/packages/dotnext.metaprogramming/5.16.0">DotNext.Metaprogramming 5.16.0</a>
11+
<a href="https://www.nuget.org/packages/dotnext.metaprogramming/5.16.1">DotNext.Metaprogramming 5.16.1</a>
1212
* Updated dependencies
1313

14-
<a href="https://www.nuget.org/packages/dotnext.unsafe/5.16.0">DotNext.Unsafe 5.16.0</a>
14+
<a href="https://www.nuget.org/packages/dotnext.unsafe/5.16.1">DotNext.Unsafe 5.16.1</a>
1515
* Updated dependencies
1616

17-
<a href="https://www.nuget.org/packages/dotnext.threading/5.16.0">DotNext.Threading 5.16.0</a>
17+
<a href="https://www.nuget.org/packages/dotnext.threading/5.16.1">DotNext.Threading 5.16.1</a>
1818
* Async locks with synchronous acquisition methods now throw [LockRecursionException](https://learn.microsoft.com/en-us/dotnet/api/system.threading.lockrecursionexception) if the current thread tries to acquire the lock synchronously and recursively.
1919
* Added support of cancellation token to synchronous acquisition methods of `AsyncExclusiveLock` and `AsyncReaderWriterLock` classes
2020
* Introduced `LinkTo` method overload that supports multiple cancellation tokens
2121

22-
<a href="https://www.nuget.org/packages/dotnext.io/5.16.0">DotNext.IO 5.16.0</a>
22+
<a href="https://www.nuget.org/packages/dotnext.io/5.16.1">DotNext.IO 5.16.1</a>
2323
* Introduced `RandomAccessStream` class that represents [Stream](https://learn.microsoft.com/en-us/dotnet/api/system.io.stream) wrapper over the underlying data storage that supports random access pattern
2424
* Added extension method for `SpanWriter<byte>` that provides length-prefixed string encoding
2525

26-
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.16.0">DotNext.Net.Cluster 5.16.0</a>
26+
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.16.1">DotNext.Net.Cluster 5.16.1</a>
2727
* Updated dependencies
2828

29-
<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.16.0">DotNext.AspNetCore.Cluster 5.16.0</a>
29+
<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.16.1">DotNext.AspNetCore.Cluster 5.16.1</a>
3030
* Updated dependencies
3131

3232
# 10-16-2024

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,33 +44,33 @@ All these things are implemented in 100% managed code on top of existing .NET AP
4444
* [NuGet Packages](https://www.nuget.org/profiles/rvsakno)
4545

4646
# What's new
47-
Release Date: 12-05-2024
47+
Release Date: 12-07-2024
4848

49-
<a href="https://www.nuget.org/packages/dotnext/5.16.0">DotNext 5.16.0</a>
49+
<a href="https://www.nuget.org/packages/dotnext/5.16.0">DotNext 5.16.1</a>
5050
* Added [LEB128](https://en.wikipedia.org/wiki/LEB128) encoder and decoder as a public API. See `DotNext.Buffers.Binary.Leb128<T>` type for more information
5151
* Added `SlideToEnd` method to `SpanWriter<T>` type
5252
* Added `IsBitSet` and `SetBit` generic methods to `Number` type
5353
* Added `DetachOrCopyBuffer` to `BufferWriterSlim<T>` type
5454

55-
<a href="https://www.nuget.org/packages/dotnext.metaprogramming/5.16.0">DotNext.Metaprogramming 5.16.0</a>
55+
<a href="https://www.nuget.org/packages/dotnext.metaprogramming/5.16.1">DotNext.Metaprogramming 5.16.1</a>
5656
* Updated dependencies
5757

58-
<a href="https://www.nuget.org/packages/dotnext.unsafe/5.16.0">DotNext.Unsafe 5.16.0</a>
58+
<a href="https://www.nuget.org/packages/dotnext.unsafe/5.16.1">DotNext.Unsafe 5.16.1</a>
5959
* Updated dependencies
6060

61-
<a href="https://www.nuget.org/packages/dotnext.threading/5.16.0">DotNext.Threading 5.16.0</a>
61+
<a href="https://www.nuget.org/packages/dotnext.threading/5.16.1">DotNext.Threading 5.16.1</a>
6262
* Async locks with synchronous acquisition methods now throw [LockRecursionException](https://learn.microsoft.com/en-us/dotnet/api/system.threading.lockrecursionexception) if the current thread tries to acquire the lock synchronously and recursively.
6363
* Added support of cancellation token to synchronous acquisition methods of `AsyncExclusiveLock` and `AsyncReaderWriterLock` classes
6464
* Introduced `LinkTo` method overload that supports multiple cancellation tokens
6565

66-
<a href="https://www.nuget.org/packages/dotnext.io/5.16.0">DotNext.IO 5.16.0</a>
66+
<a href="https://www.nuget.org/packages/dotnext.io/5.16.1">DotNext.IO 5.16.1</a>
6767
* Introduced `RandomAccessStream` class that represents [Stream](https://learn.microsoft.com/en-us/dotnet/api/system.io.stream) wrapper over the underlying data storage that supports random access pattern
6868
* Added extension method for `SpanWriter<byte>` that provides length-prefixed string encoding
6969

70-
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.16.0">DotNext.Net.Cluster 5.16.0</a>
70+
<a href="https://www.nuget.org/packages/dotnext.net.cluster/5.16.1">DotNext.Net.Cluster 5.16.1</a>
7171
* Updated dependencies
7272

73-
<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.16.0">DotNext.AspNetCore.Cluster 5.16.0</a>
73+
<a href="https://www.nuget.org/packages/dotnext.aspnetcore.cluster/5.16.1">DotNext.AspNetCore.Cluster 5.16.1</a>
7474
* Updated dependencies
7575

7676
Changelog for previous versions located [here](./CHANGELOG.md).

src/DotNext.Benchmarks/DotNext.Benchmarks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RootNamespace>DotNext</RootNamespace>
99
<StartupObject>DotNext.Program</StartupObject>
1010
<IsPackable>false</IsPackable>
11-
<Version>5.16.0</Version>
11+
<Version>5.16.1</Version>
1212
<Authors>.NET Foundation and Contributors</Authors>
1313
<Product>.NEXT Family of Libraries</Product>
1414
<Description>Various benchmarks demonstrating performance aspects of .NEXT extensions</Description>

src/DotNext.IO/Buffers/Binary/Leb128Reader.cs renamed to src/DotNext.IO/Buffers/Binary/SevenBitEncodedIntReader.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
namespace DotNext.Buffers.Binary;
66

77
[StructLayout(LayoutKind.Auto)]
8-
internal struct Leb128Reader<T>() : IBufferReader, ISupplier<T>
9-
where T : struct, IBinaryInteger<T>
8+
internal struct SevenBitEncodedIntReader() : IBufferReader, ISupplier<int>
109
{
11-
private Leb128<T> decoder;
10+
private Leb128<uint> decoder;
1211
private bool incompleted = true;
1312

1413
readonly int IBufferReader.RemainingBytes => Unsafe.BitCast<bool, byte>(incompleted);
1514

1615
void IReadOnlySpanConsumer<byte>.Invoke(ReadOnlySpan<byte> source)
1716
=> incompleted = decoder.Append(MemoryMarshal.GetReference(source));
1817

19-
readonly T ISupplier<T>.Invoke() => decoder.Value;
18+
readonly int ISupplier<int>.Invoke() => (int)decoder.Value;
2019
}

src/DotNext.IO/Buffers/BufferWriter.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ static void WriteSlow(IBufferWriter<T> writer, in ReadOnlySequence<T> value)
4444

4545
internal static unsafe int WriteLength(this ref SpanWriter<byte> destination, int value, LengthFormat lengthFormat)
4646
{
47-
delegate*<ref SpanWriter<byte>, int, int> writer = lengthFormat switch
47+
Debug.Assert(value >= 0);
48+
49+
delegate*<ref SpanWriter<byte>, uint, int> writer = lengthFormat switch
4850
{
4951
LengthFormat.LittleEndian => &ByteBuffer.WriteLittleEndian,
5052
LengthFormat.BigEndian => &ByteBuffer.WriteBigEndian,
51-
LengthFormat.Compressed => &ByteBuffer.WriteLeb128<int>,
53+
LengthFormat.Compressed => &ByteBuffer.WriteLeb128<uint>,
5254
_ => throw new ArgumentOutOfRangeException(nameof(lengthFormat)),
5355
};
5456

55-
return writer(ref destination, value);
57+
return writer(ref destination, (uint)value);
5658
}
5759

5860
internal static int WriteLength(this IBufferWriter<byte> buffer, int length, LengthFormat lengthFormat)

src/DotNext.IO/DotNext.IO.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Authors>.NET Foundation and Contributors</Authors>
1212
<Company />
1313
<Product>.NEXT Family of Libraries</Product>
14-
<VersionPrefix>5.16.0</VersionPrefix>
14+
<VersionPrefix>5.16.1</VersionPrefix>
1515
<VersionSuffix></VersionSuffix>
1616
<AssemblyName>DotNext.IO</AssemblyName>
1717
<PackageLicenseExpression>MIT</PackageLicenseExpression>

src/DotNext.IO/IO/FileReader.Binary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ValueTask<TReader> IAsyncBinaryReader.ReadAsync<TReader>(TReader reader, Cancell
127127
{
128128
LengthFormat.LittleEndian => ReadLittleEndianAsync<int>(token),
129129
LengthFormat.BigEndian => ReadBigEndianAsync<int>(token),
130-
LengthFormat.Compressed => ReadAsync<int, Leb128Reader<int>>(new(), token),
130+
LengthFormat.Compressed => ReadAsync<int, SevenBitEncodedIntReader>(new(), token),
131131
_ => ValueTask.FromException<int>(new ArgumentOutOfRangeException(nameof(lengthFormat))),
132132
};
133133

src/DotNext.IO/IO/IAsyncBinaryReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private async ValueTask<TResult> ReadAsync<TResult, TReader>(TReader reader, Can
9999
{
100100
LengthFormat.LittleEndian => ReadLittleEndianAsync<int>(token),
101101
LengthFormat.BigEndian => ReadBigEndianAsync<int>(token),
102-
LengthFormat.Compressed => ReadAsync<int, Leb128Reader<int>>(new(), token),
102+
LengthFormat.Compressed => ReadAsync<int, SevenBitEncodedIntReader>(new(), token),
103103
_ => ValueTask.FromException<int>(new ArgumentOutOfRangeException(nameof(lengthFormat))),
104104
};
105105

src/DotNext.IO/IO/Pipelines/PipeExtensions.Readers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ public static ValueTask<T> ReadBigEndianAsync<T>(this PipeReader reader, Cancell
154154
{
155155
LengthFormat.LittleEndian => reader.ReadLittleEndianAsync<int>(token),
156156
LengthFormat.BigEndian => reader.ReadBigEndianAsync<int>(token),
157-
LengthFormat.Compressed => ReadAsync<int, Leb128Reader<int>>(reader, new(), token),
157+
LengthFormat.Compressed => ReadAsync<int, SevenBitEncodedIntReader>(reader, new(), token),
158158
_ => ValueTask.FromException<int>(new ArgumentOutOfRangeException(nameof(lengthFormat))),
159159
};
160160

src/DotNext.IO/IO/SequenceReader.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,8 @@ public MemoryOwner<byte> ReadBlock(LengthFormat lengthFormat, MemoryAllocator<by
271271

272272
private int Read7BitEncodedInt32()
273273
{
274-
var parser = new Leb128Reader<int>();
275-
return Read<int, Leb128Reader<int>>(ref parser);
274+
var parser = new SevenBitEncodedIntReader();
275+
return Read<int, SevenBitEncodedIntReader>(ref parser);
276276
}
277277

278278
private int ReadLength(LengthFormat lengthFormat) => lengthFormat switch

0 commit comments

Comments
 (0)