Skip to content

Commit

Permalink
Increased chance of inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Dec 4, 2024
1 parent c8721a4 commit 6bc341d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DotNext/Buffers/Binary/SevenBitEncodedInteger.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -45,11 +47,16 @@ static SevenBitEncodedInteger()
public bool Append(byte b)
{
if (shift == MaxSizeInBits)
throw new InvalidDataException();
ThrowInvalidDataException();

value |= (T.CreateTruncating(b) & Ox7FU) << shift;
shift += 7;
return (b & 0x80U) is not 0U;

[DoesNotReturn]
[StackTraceHidden]
static void ThrowInvalidDataException()
=> throw new InvalidDataException();
}

/// <summary>
Expand Down

0 comments on commit 6bc341d

Please sign in to comment.