Skip to content

Commit 7717d31

Browse files
committed
don't use memory.span if not needed (is a slow operation)
1 parent 16e11ec commit 7717d31

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/RabbitMQ.Client/client/impl/WireFormatting.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ public static int WriteShortstr(Memory<byte> memory, string val)
434434
int bytesWritten = Encoding.UTF8.GetBytes(val, 0, val.Length, segment.Array, segment.Offset + 1);
435435
if (bytesWritten <= byte.MaxValue)
436436
{
437-
memory.Span[0] = (byte)bytesWritten;
438-
return bytesWritten + 1;
437+
segment.Array[segment.Offset] = (byte)bytesWritten;
438+
return bytesWritten + 1;
439439
}
440440

441441
throw new ArgumentOutOfRangeException(nameof(val), val, "Value exceeds the maximum allowed length of 255 bytes.");

0 commit comments

Comments
 (0)