Skip to content

Commit f9110fe

Browse files
committed
[Proto] Remove meaningless Inlining
1 parent fdb89c0 commit f9110fe

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Lagrange.Proto/Primitives/ProtoWriter.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public void EncodeString(ReadOnlySpan<char> str)
4242
int min = ProtoHelper.GetVarIntMin(count);
4343
int max = ProtoHelper.GetVarIntMax(count);
4444
int utf16Max = ProtoConstants.MaxExpansionFactorWhileTranscoding * str.Length;
45-
if (_memory.Length < utf16Max) Grow(utf16Max);
45+
if (_memory.Length < utf16Max + count) Grow(utf16Max + count);
4646

47-
if (str.Length > min && utf16Max < max) // falls within the range
47+
if (str.Length + count > min && utf16Max + count < max) // falls within the range
4848
{
4949
BytesPending += count;
5050
var status = ProtoWriteHelper.ToUtf8(str, _memory.Span[BytesPending..], out int written);
@@ -91,7 +91,6 @@ public void EncodeFixed64<T>(T value) where T : unmanaged, INumber<T>
9191
BytesPending += 8;
9292
}
9393

94-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
9594
public void EncodeVarInt<T>(T value) where T : unmanaged, INumber<T>
9695
{
9796
if (_memory.Length - BytesPending >= 10)

0 commit comments

Comments
 (0)