optimize WriteRawByte

This commit is contained in:
Jan Tattermusch 2020-06-23 16:53:05 +02:00
parent 6afd469fe0
commit 80780bdffa
2 changed files with 3 additions and 3 deletions

View File

@ -117,7 +117,7 @@ namespace Google.Protobuf
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[MethodImpl(MethodImplOptions.NoInlining)]
public static void RefreshBuffer(ref Span<byte> buffer, ref WriterInternalState state)
{
if (state.writeBufferHelper.codedOutputStream?.InternalOutputStream != null)

View File

@ -397,9 +397,9 @@ namespace Google.Protobuf
WriteRawByte(ref buffer, ref state, (byte)(value >> 56));
}
public static void WriteRawByte(ref Span<byte> buffer, ref WriterInternalState state, byte value)
private static void WriteRawByte(ref Span<byte> buffer, ref WriterInternalState state, byte value)
{
if (state.position == state.limit)
if (state.position == buffer.Length)
{
WriteBufferHelper.RefreshBuffer(ref buffer, ref state);
}