fix: Fixes benchmarks (#729)

This commit is contained in:
Kamron Batman 2021-08-25 00:35:07 -07:00 committed by GitHub
parent 0dc4acc164
commit 1a336752a6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View file

@ -16,6 +16,7 @@ namespace Server.Tests
void AppendLayout(bool val);
void AppendLayout(int val);
void AppendLayout(uint val);
void AppendLayout(Serial serial);
void AppendLayoutNS(int val);
void AppendLayout(string text);
void AppendLayoutNS(string text);
@ -89,6 +90,8 @@ namespace Server.Tests
m_Layout.Write(m_Buffer, 0, bytes);
}
public void AppendLayout(Serial serial) => AppendLayout(serial.Value);
public void AppendLayoutNS(int val)
{
var toString = val.ToString();
@ -232,6 +235,8 @@ namespace Server.Tests
m_LayoutLength += bytes;
}
public void AppendLayout(Serial serial) => AppendLayout(serial.Value);
public void AppendLayoutNS(int val)
{
var toString = val.ToString();

View file

@ -14,7 +14,7 @@ namespace Benchmarks
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Write(this Span<byte> data, ref int pos, Serial serial)
{
BinaryPrimitives.WriteUInt32BigEndian(data.Slice(pos, 4), serial);
BinaryPrimitives.WriteUInt32BigEndian(data.Slice(pos, 4), serial.Value);
pos += 4;
}

View file

@ -111,6 +111,8 @@ namespace Server.Network
UnderlyingStream.Write(m_Buffer, 0, 2);
}
public void Write(Serial serial) => Write(serial.Value);
/// <summary>
/// Writes a 4-byte signed integer value to the underlying stream.
/// </summary>