mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-09 23:25:43 +00:00
perf: accept ReadOnlySpan<byte> in WriteInternal
This method does not mutate the input span in any way, and so its input can be read-only.
This commit is contained in:
parent
2815c505c3
commit
990f860b39
@ -1,4 +1,4 @@
|
|||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
@ -1147,7 +1147,7 @@ public static class StreamExtensions
|
|||||||
return (int)(stream.Position - preWritePosition);
|
return (int)(stream.Position - preWritePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int WriteInternal(this Stream stream, Span<byte> value)
|
private static int WriteInternal(this Stream stream, ReadOnlySpan<byte> value)
|
||||||
{
|
{
|
||||||
long preWritePosition = stream.Position;
|
long preWritePosition = stream.Position;
|
||||||
stream.Write(value);
|
stream.Write(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user