Skip to content

Commit

Permalink
Removed redundant negation
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Dec 4, 2024
1 parent 603e1cf commit c176a64
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/DotNext.IO/Buffers/Binary/SevenBitEncodedInt32Reader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ namespace DotNext.Buffers.Binary;
internal struct SevenBitEncodedInt32Reader : IBufferReader, ISupplier<int>
{
private SevenBitEncodedInteger<uint> decoder;
private bool completed;
private bool incompleted;

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

void IReadOnlySpanConsumer<byte>.Invoke(ReadOnlySpan<byte> source)
=> completed = decoder.Append(MemoryMarshal.GetReference(source)) is false;
=> incompleted = decoder.Append(MemoryMarshal.GetReference(source));

readonly int ISupplier<int>.Invoke() => (int)decoder.Value;
}

0 comments on commit c176a64

Please sign in to comment.