381 instantiations of Span
InMemory.FunctionalTests (3)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (1)
Microsoft.AspNetCore.Components.Server (1)
Microsoft.AspNetCore.Components.Server.Tests (1)
Microsoft.AspNetCore.DataProtection (7)
Managed\AesGcmAuthenticatedEncryptor.cs (6)
124var nonce = new Span<byte>(ciphertext.Array, nonceOffset, NONCE_SIZE_IN_BYTES);
125var tag = new Span<byte>(ciphertext.Array, tagOffset, TAG_SIZE_IN_BYTES);
126var encrypted = new Span<byte>(ciphertext.Array, encryptedDataOffset, plaintextBytes);
197var nonce = new Span<byte>(retVal, nonceOffset, NONCE_SIZE_IN_BYTES);
198var tag = new Span<byte>(retVal, tagOffset, TAG_SIZE_IN_BYTES);
199var encrypted = new Span<byte>(retVal, encryptedDataOffset, plaintext.Count);
Microsoft.AspNetCore.Http.Connections.Common (1)
Microsoft.AspNetCore.OpenApi (1)
Microsoft.AspNetCore.Server.HttpSys (7)
Microsoft.AspNetCore.Server.IIS (5)
Microsoft.AspNetCore.Server.Kestrel.Core (2)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (24)
BufferWriterTests.cs (6)
51writer.Write(new Span<byte>(array, 0, 0));
52writer.Write(new Span<byte>(array, array.Length, 0));
56writer.Write(new Span<byte>(array, offset, length));
64writer.Write(new Span<byte>(array, 0, array.Length));
80writer.Write(new Span<byte>(array, offset, length));
98writer.Write(new Span<byte>(array, 0, array.Length));
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (9)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (3)
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (3)
Microsoft.AspNetCore.Shared.Tests (11)
Microsoft.AspNetCore.SignalR.Common (2)
Microsoft.AspNetCore.SignalR.Protocols.Json (2)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (2)
Microsoft.AspNetCore.WebUtilities (3)
Microsoft.AspNetCore.WebUtilities.Tests (3)
Microsoft.Build (2)
Microsoft.Extensions.Caching.Hybrid.Tests (1)
PresentationCore (1)
System.Collections.Immutable (4)
System.ComponentModel.TypeConverter (1)
System.Console (3)
System.Data.Common (1)
System.Diagnostics.DiagnosticSource (1)
System.Diagnostics.Process (2)
System.Formats.Asn1 (4)
System.Formats.Cbor (1)
System.Formats.Tar (1)
System.IO.Compression (6)
System.IO.Compression.Brotli (4)
System.IO.Hashing (9)
System\IO\Hashing\XxHashShared.cs (9)
117Debug.Assert(new Span<byte>(secret, SecretLengthBytes).SequenceEqual(DefaultSecret));
168DefaultSecret.CopyTo(new Span<byte>(secret, SecretLengthBytes));
251source.CopyTo(new Span<byte>(buffer + state.BufferedCount, source.Length));
266source.Slice(0, loadSize).CopyTo(new Span<byte>(buffer + state.BufferedCount, loadSize));
305source.Slice(sourceIndex - StripeLengthBytes, StripeLengthBytes).CopyTo(new Span<byte>(buffer + InternalBufferLengthBytes - StripeLengthBytes, StripeLengthBytes));
318source.Slice(sourceIndex - StripeLengthBytes, StripeLengthBytes).CopyTo(new Span<byte>(buffer + InternalBufferLengthBytes - StripeLengthBytes, StripeLengthBytes));
322Span<byte> remaining = new Span<byte>(buffer, source.Length - sourceIndex);
381new ReadOnlySpan<byte>(buffer + InternalBufferLengthBytes - catchupSize, catchupSize).CopyTo(new Span<byte>(lastStripe, StripeLengthBytes));
382new ReadOnlySpan<byte>(buffer, (int)state.BufferedCount).CopyTo(new Span<byte>(lastStripe + catchupSize, (int)state.BufferedCount));
System.IO.Pipelines (1)
System.IO.Pipes (2)
System.Linq (1)
System.Memory (1)
System.Memory.Data (2)
System.Net.Http (7)
System.Net.NameResolution (2)
System.Net.Ping (2)
System.Net.Primitives (3)
System.Net.Quic (10)
System.Net.Requests (1)
System.Net.Security (10)
System.Net.Sockets (9)
System\Net\Sockets\SocketAsyncContext.Unix.cs (2)
547bool completed = SocketPal.TryCompleteReceiveFrom(context._socket, new Span<byte>(BufferPtr, Length), null, Flags, SocketAddress.Span, out int socketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode);
604bool completed = SocketPal.TryCompleteReceiveMessageFrom(context._socket, new Span<byte>(BufferPtr, Length), null, Flags, SocketAddress!, out int socketAddressLen, IsIPv4, IsIPv6, out BytesTransferred, out ReceivedFlags, out IPPacketInformation, out ErrorCode);
System\Net\Sockets\SocketPal.Unix.cs (5)
761received = SysReceive(socket, flags | SocketFlags.Peek, new Span<byte>(&oneBytePeekBuffer, 1), out errno);
829received = SysReceive(socket, flags | SocketFlags.Peek, new Span<byte>(&oneBytePeekBuffer, 1), socketAddress, out receivedSocketAddressLength, out receivedFlags, out errno);
1255bool completed = TryCompleteReceive(handle, new Span<byte>(buffer, offset, count), socketFlags, out bytesTransferred, out errorCode);
1285if (!TryCompleteReceiveMessageFrom(handle, new Span<byte>(buffer, offset, count), null, socketFlags, socketAddress.Buffer, out socketAddressLen, isIPv4, isIPv6, out bytesTransferred, out socketFlags, out ipPacketInformation, out errorCode))
1330bool completed = TryCompleteReceiveFrom(handle, new Span<byte>(buffer, offset, count), socketFlags, socketAddress.Span, out socketAddressLen, out bytesTransferred, out socketFlags, out errorCode);
System.Net.WebClient (1)
System.Net.WebSockets (4)
System.Private.CoreLib (149)
src\libraries\System.Private.CoreLib\src\System\Array.cs (8)
1101new Span<T>(array).Fill(value);
1132new Span<T>(ref first, count).Fill(value);
2130var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2179var span = new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), length);
2203var spanKeys = new Span<TKey>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(keys), index), length);
2204var spanItems = new Span<TValue>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(items), index), length);
2221var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2692new Span<T>(ref Unsafe.As<byte, T>(ref MemoryMarshal.GetArrayDataReference(array)), array.Length).Slice(adjustedIndex, length);
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (6)
933TryFormatS(dateTime, new Span<char>(ref str.GetRawStringData(), str.Length), out int charsWritten);
940TryFormatInvariantG(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out int charsWritten);
959TryFormatInvariantG(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out int charsWritten);
985TryFormatR(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten);
992TryFormatS(dateTime, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten);
999TryFormatu(dateTime, offset, new Span<char>(ref str.GetRawStringData(), str.Length), out charsWritten);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (9)
40return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), array.Length - start);
64return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)actualIndex /* force zero-extension */), array.Length - actualIndex);
88return new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), (nint)(uint)start /* force zero-extension */), length);
2639return new Span<T>(array);
2657return new Span<T>(array, start, length);
2666return new Span<T>(segment.Array, segment.Offset, segment.Count);
2686return new Span<T>(segment.Array, segment.Offset + start, segment.Count - start);
2722return new Span<T>(segment.Array, segment.Offset + start, length);
2734return new Span<T>(segment.Array, segment.Offset + start, length);
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (14)
325var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
353var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
919var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
978var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
1033var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
1090var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
1149var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
1210var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
1265var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
1322var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
1383var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
1444var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
1501var vlb = new ValueListBuilder<char>(new Span<char>(stackPtr, CharStackBufferSize));
1558var vlb = new ValueListBuilder<TChar>(new Span<TChar>(stackPtr, CharStackBufferSize));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshal.cs (9)
233new Span<T>(source, startIndex, length).CopyTo(new Span<T>((void*)destination, length));
286new Span<T>((void*)source, length).CopyTo(new Span<T>(destination, startIndex, length));
959s.CopyTo(new Span<char>((char*)ptr, s.Length));
977int nbWritten = Encoding.UTF8.GetBytes(s, new Span<byte>(pbMem, nb));
1000s.CopyTo(new Span<char>((char*)ptr, s.Length));
1018int nbWritten = Encoding.UTF8.GetBytes(s, new Span<byte>(pbMem, nb));
1230s.CopyTo(new Span<char>((char*)bstr, s.Length)); // AllocBSTR already included the null terminator
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (4)
372CopyTo(startIndex, new Span<char>(ref result.GetRawStringData(), result.Length), result.Length);
851value.CopyTo(startIndex, new Span<char>(m_ChunkChars, m_ChunkLength, length), length);
880CopyTo(sourceIndex, new Span<char>(destination).Slice(destinationIndex), count);
2522get => new Span<char>(m_ChunkChars, m_ChunkLength, m_ChunkChars.Length - m_ChunkLength);
System.Private.DataContractSerialization (3)
System.Private.Xml (1)
System.Reflection.Metadata (4)
System.Runtime.Numerics (2)
System.Security.Cryptography (24)
System\Security\Cryptography\CryptoStream.cs (5)
362CryptographicOperations.ZeroMemory(new Span<byte>(_inputBuffer, 0, _inputBufferIndex));
396CryptographicOperations.ZeroMemory(new Span<byte>(tempOutputBuffer, 0, numOutputBytes));
417CryptographicOperations.ZeroMemory(new Span<byte>(tempInputBuffer, 0, numWholeBlocksInBytes));
611CryptographicOperations.ZeroMemory(new Span<byte>(tempOutputBuffer, 0, numOutputBytes));
617CryptographicOperations.ZeroMemory(new Span<byte>(tempOutputBuffer, 0, numOutputBytes));
System.Security.Cryptography.Cose (1)
System.Text.Encoding.CodePages (1)
System.Text.Encodings.Web (2)
System.Text.Json (3)
5054 references to Span
http2cat (57)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
IIS.FunctionalTests (57)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
IIS.LongTests (57)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
IIS.NewHandler.FunctionalTests (57)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
IIS.NewShim.FunctionalTests (57)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
IIS.ShadowCopy.Tests (13)
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
IISExpress.FunctionalTests (57)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
InMemory.FunctionalTests (37)
src\Servers\Kestrel\shared\HPackHeaderWriter.cs (5)
20public static bool BeginEncodeHeaders(int statusCode, DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
51public static bool BeginEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
74public static bool ContinueEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
79private static bool EncodeStatusHeader(int statusCode, DynamicHPackEncoder hpackEncoder, Span<byte> buffer, out int length)
94private static bool EncodeHeadersCore(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
Microsoft.AspNetCore.App.Analyzers (1)
Microsoft.AspNetCore.Authentication.Certificate (2)
Microsoft.AspNetCore.Authentication.JwtBearer.Tools.Tests (1)
Microsoft.AspNetCore.Components (17)
src\Shared\UrlDecoder\UrlDecoder.cs (11)
18public static int DecodeRequestLine(ReadOnlySpan<byte> source, Span<byte> destination, bool isFormEncoding)
42public static int DecodeInPlace(Span<byte> buffer, bool isFormEncoding)
96private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<byte> buffer, bool isFormEncoding)
234private static void Copy<T>(int begin, int end, ref int writer, Span<T> buffer)
262private static int UnescapePercentEncoding(ref int scan, Span<byte> buffer, bool isFormEncoding)
301private static int ReadHex(ref int scan, Span<byte> buffer)
355/// Form Encoding is not supported compared to the <see cref="DecodeRequestLine(ReadOnlySpan{byte}, Span{byte}, bool)" />
358public static int DecodeRequestLine(ReadOnlySpan<char> source, Span<char> destination)
374/// Form Encoding is not supported compared to the <see cref="DecodeInPlace(Span{byte}, bool)" />
377public static int DecodeInPlace(Span<char> buffer)
434private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<char> buffer)
Microsoft.AspNetCore.Components.Endpoints (6)
Microsoft.AspNetCore.Components.Forms (3)
Microsoft.AspNetCore.Components.Forms.Tests (5)
Microsoft.AspNetCore.Components.Server (82)
src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\MessagePackWriter.cs (65)
89Span<byte> span = this.writer.GetSpan(1);
133Span<byte> span = this.writer.GetSpan(1);
139Span<byte> span = this.writer.GetSpan(3);
146Span<byte> span = this.writer.GetSpan(5);
173Span<byte> span = this.writer.GetSpan(1);
179Span<byte> span = this.writer.GetSpan(3);
186Span<byte> span = this.writer.GetSpan(5);
201Span<byte> span = this.writer.GetSpan(1);
217Span<byte> span = this.writer.GetSpan(2);
235Span<byte> span = this.writer.GetSpan(1);
247Span<byte> span = this.writer.GetSpan(2);
261Span<byte> span = this.writer.GetSpan(1);
267Span<byte> span = this.writer.GetSpan(2);
284Span<byte> span = this.writer.GetSpan(3);
310Span<byte> span = this.writer.GetSpan(1);
316Span<byte> span = this.writer.GetSpan(2);
334Span<byte> span = this.writer.GetSpan(3);
353Span<byte> span = this.writer.GetSpan(1);
359Span<byte> span = this.writer.GetSpan(2);
366Span<byte> span = this.writer.GetSpan(3);
383Span<byte> span = this.writer.GetSpan(5);
412Span<byte> span = this.writer.GetSpan(1);
418Span<byte> span = this.writer.GetSpan(2);
425Span<byte> span = this.writer.GetSpan(3);
443Span<byte> span = this.writer.GetSpan(5);
464Span<byte> span = this.writer.GetSpan(1);
470Span<byte> span = this.writer.GetSpan(2);
477Span<byte> span = this.writer.GetSpan(3);
484Span<byte> span = this.writer.GetSpan(5);
501Span<byte> span = this.writer.GetSpan(9);
531Span<byte> span = this.writer.GetSpan(1);
537Span<byte> span = this.writer.GetSpan(2);
544Span<byte> span = this.writer.GetSpan(3);
551Span<byte> span = this.writer.GetSpan(5);
569Span<byte> span = this.writer.GetSpan(9);
581Span<byte> span = this.writer.GetSpan(1);
598Span<byte> span = this.writer.GetSpan(5);
610Span<byte> span = this.writer.GetSpan(9);
682Span<byte> span = this.writer.GetSpan(6);
691Span<byte> span = this.writer.GetSpan(10);
701Span<byte> span = this.writer.GetSpan(15);
746var span = this.writer.GetSpan(length);
765var span = this.writer.GetSpan(length);
800Span<byte> span = this.writer.GetSpan(size);
810Span<byte> span = this.writer.GetSpan(size);
820Span<byte> span = this.writer.GetSpan(size);
841Span<byte> span = this.writer.GetSpan(length);
858Span<byte> span = this.writer.GetSpan(length);
882Span<byte> span = this.writer.GetSpan(byteCount + 1);
888Span<byte> span = this.writer.GetSpan(byteCount + 2);
895Span<byte> span = this.writer.GetSpan(byteCount + 3);
902Span<byte> span = this.writer.GetSpan(byteCount + 5);
974Span<byte> span = this.writer.GetSpan(2);
1067public Span<byte> GetSpan(int length) => this.writer.GetSpan(length);
1082Span<byte> span = this.writer.GetSpan(2);
1093Span<byte> span = this.writer.GetSpan(4);
1104Span<byte> span = this.writer.GetSpan(8);
1129private static void WriteBigEndian(short value, Span<byte> span) => WriteBigEndian(unchecked((ushort)value), span);
1131private static void WriteBigEndian(int value, Span<byte> span) => WriteBigEndian(unchecked((uint)value), span);
1133private static void WriteBigEndian(long value, Span<byte> span) => WriteBigEndian(unchecked((ulong)value), span);
1135private static void WriteBigEndian(ushort value, Span<byte> span)
1154private static void WriteBigEndian(uint value, Span<byte> span)
1177private static void WriteBigEndian(ulong value, Span<byte> span)
1193private static unsafe void WriteBigEndian(float value, Span<byte> span) => WriteBigEndian(*(int*)&value, span);
1195private static unsafe void WriteBigEndian(double value, Span<byte> span) => WriteBigEndian(*(long*)&value, span);
Microsoft.AspNetCore.Components.Server.Tests (11)
Microsoft.AspNetCore.Components.Web (3)
Microsoft.AspNetCore.DataProtection (7)
Managed\AesGcmAuthenticatedEncryptor.cs (6)
124var nonce = new Span<byte>(ciphertext.Array, nonceOffset, NONCE_SIZE_IN_BYTES);
125var tag = new Span<byte>(ciphertext.Array, tagOffset, TAG_SIZE_IN_BYTES);
126var encrypted = new Span<byte>(ciphertext.Array, encryptedDataOffset, plaintextBytes);
197var nonce = new Span<byte>(retVal, nonceOffset, NONCE_SIZE_IN_BYTES);
198var tag = new Span<byte>(retVal, tagOffset, TAG_SIZE_IN_BYTES);
199var encrypted = new Span<byte>(retVal, encryptedDataOffset, plaintext.Count);
Microsoft.AspNetCore.DataProtection.Abstractions (2)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Abstractions (18)
src\Shared\UrlDecoder\UrlDecoder.cs (11)
18public static int DecodeRequestLine(ReadOnlySpan<byte> source, Span<byte> destination, bool isFormEncoding)
42public static int DecodeInPlace(Span<byte> buffer, bool isFormEncoding)
96private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<byte> buffer, bool isFormEncoding)
234private static void Copy<T>(int begin, int end, ref int writer, Span<T> buffer)
262private static int UnescapePercentEncoding(ref int scan, Span<byte> buffer, bool isFormEncoding)
301private static int ReadHex(ref int scan, Span<byte> buffer)
355/// Form Encoding is not supported compared to the <see cref="DecodeRequestLine(ReadOnlySpan{byte}, Span{byte}, bool)" />
358public static int DecodeRequestLine(ReadOnlySpan<char> source, Span<char> destination)
374/// Form Encoding is not supported compared to the <see cref="DecodeInPlace(Span{byte}, bool)" />
377public static int DecodeInPlace(Span<char> buffer)
434private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<char> buffer)
Microsoft.AspNetCore.Http.Connections (5)
Microsoft.AspNetCore.Http.Connections.Common (3)
Microsoft.AspNetCore.Http.Extensions (13)
Microsoft.AspNetCore.Http.Extensions.Tests (1)
Microsoft.AspNetCore.HttpLogging (11)
Microsoft.AspNetCore.Identity.FunctionalTests (6)
Microsoft.AspNetCore.Localization (1)
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
Microsoft.AspNetCore.OpenApi (5)
Microsoft.AspNetCore.OutputCaching (6)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (2)
Microsoft.AspNetCore.Razor.Runtime (1)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Rewrite (1)
Microsoft.AspNetCore.Routing (13)
Microsoft.AspNetCore.Routing.Microbenchmarks (4)
Microsoft.AspNetCore.Routing.Tests (8)
Microsoft.AspNetCore.Server.HttpSys (37)
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (53)
src\Shared\Http2cat\HPackHeaderWriter.cs (5)
16public static bool BeginEncodeHeaders(int statusCode, IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
40public static bool BeginEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
54public static bool ContinueEncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, out int length)
59private static bool EncodeHeaders(IEnumerator<KeyValuePair<string, string>> headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
86private static bool EncodeHeader(string name, string value, Span<byte> buffer, out int length)
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
Microsoft.AspNetCore.Server.HttpSys.Microbenchmarks (9)
Microsoft.AspNetCore.Server.HttpSys.Tests (32)
RequestHeaderTests.cs (32)
23var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
44Span<byte> nativeMemory = buffer.Span;
64var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
85Span<byte> nativeMemory = buffer.Span;
105var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
124var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
143var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
146var remainingMemory = SetUnknownHeaders(nativeMemory, ref requestStructure, new[] { (CustomHeader1, "1"), (CustomHeader2, null) });
167Span<byte> nativeMemory = buffer.Span;
170var remainingMemory = SetUnknownHeaders(nativeMemory, ref requestStructure, new[] { (CustomHeader1, "1"), (CustomHeader2, null) });
190var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
212var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
234var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
255var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
275var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
297var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
319var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
340var nativeMemory = new Span<byte>(nativeContext.NativeRequest, (int)nativeContext.Size + 8);
356private static unsafe Span<byte> SetHostAndContentTypeHeaders(Span<byte> nativeMemory, ref HTTP_REQUEST_V1 requestStructure)
359var dataDestination = nativeMemory.Slice(Marshal.SizeOf<HTTP_REQUEST_V1>());
380private static unsafe Span<byte> SetInvalidHostHeader(Span<byte> nativeMemory, ref HTTP_REQUEST_V1 requestStructure)
383var dataDestination = nativeMemory.Slice(Marshal.SizeOf<HTTP_REQUEST_V1>());
400private static unsafe Span<byte> SetUnknownHeaders(Span<byte> nativeMemory, ref HTTP_REQUEST_V1 requestStructure, IReadOnlyCollection<(string Key, string Value)> headerNames)
402var unknownHeaderStructureDestination = nativeMemory.Slice(Marshal.SizeOf<HTTP_REQUEST_V1>());
410var dataDestination = unknownHeaderStructureDestination.Slice(unknownHeadersSize * headerNames.Count);
438private static unsafe Span<byte> SetInvalidUnknownHeaders(Span<byte> nativeMemory, ref HTTP_REQUEST_V1 requestStructure, IReadOnlyCollection<string> headerNames)
440var unknownHeaderStructureDestination = nativeMemory.Slice(Marshal.SizeOf<HTTP_REQUEST_V1>());
450var dataDestination = unknownHeaderStructureDestination.Slice(unknownHeadersSize * headerNames.Count);
Microsoft.AspNetCore.Server.IIS (33)
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
Microsoft.AspNetCore.Server.Kestrel.Core (146)
Internal\Http3\QPackHeaderWriter.cs (6)
12public static bool BeginEncodeHeaders(Http3HeadersEnumerator enumerator, Span<byte> buffer, ref int totalHeaderSize, out int length)
27public static bool BeginEncodeHeaders(int statusCode, Http3HeadersEnumerator headersEnumerator, Span<byte> buffer, ref int totalHeaderSize, out int length)
50public static bool Encode(Http3HeadersEnumerator headersEnumerator, Span<byte> buffer, ref int totalHeaderSize, out int length)
55private static bool Encode(Http3HeadersEnumerator headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, ref int totalHeaderSize, out int length)
104private static bool EncodeHeader(Span<byte> buffer, int staticTableId, string name, string value, Encoding? valueEncoding, out int headerLength)
111private static int EncodeStatusCode(int statusCode, Span<byte> buffer)
src\Servers\Kestrel\shared\HPackHeaderWriter.cs (5)
20public static bool BeginEncodeHeaders(int statusCode, DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
51public static bool BeginEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
74public static bool ContinueEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
79private static bool EncodeStatusHeader(int statusCode, DynamicHPackEncoder hpackEncoder, Span<byte> buffer, out int length)
94private static bool EncodeHeadersCore(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
src\Shared\Hpack\DynamicHPackEncoder.cs (3)
54public bool EnsureDynamicTableSizeUpdate(Span<byte> buffer, out int length)
68public bool EncodeHeader(Span<byte> buffer, int staticTableIndex, HeaderEncodingHint encodingHint, string name, string value,
117private bool EncodeDynamicHeader(Span<byte> buffer, int staticTableIndex, string name, string value,
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\runtime\Http3\QPack\QPackEncoder.cs (18)
23public static bool EncodeStaticIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
39Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
61public static bool EncodeLiteralHeaderFieldWithStaticNameReference(int index, string value, Span<byte> destination, out int bytesWritten)
66public static bool EncodeLiteralHeaderFieldWithStaticNameReference(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
89/// Encodes just the name part of a Literal Header Field With Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
93Span<byte> temp = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
104Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
125public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, string value, Span<byte> destination, out int bytesWritten)
130public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
147public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
160/// Encodes just the value part of a Literawl Header Field Without Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
164Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
174Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
182private static bool EncodeValueString(string s, Encoding? valueEncoding, Span<byte> buffer, out int length)
220public static bool EncodeValueString(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> buffer, out int length)
301private static void EncodeValueStringPart(string s, Span<byte> buffer)
316private static bool EncodeNameString(string s, Span<byte> buffer, out int length)
355private static bool EncodeHeaderBlockPrefix(Span<byte> destination, out int bytesWritten)
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
src\Shared\UrlDecoder\UrlDecoder.cs (11)
18public static int DecodeRequestLine(ReadOnlySpan<byte> source, Span<byte> destination, bool isFormEncoding)
42public static int DecodeInPlace(Span<byte> buffer, bool isFormEncoding)
96private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<byte> buffer, bool isFormEncoding)
234private static void Copy<T>(int begin, int end, ref int writer, Span<T> buffer)
262private static int UnescapePercentEncoding(ref int scan, Span<byte> buffer, bool isFormEncoding)
301private static int ReadHex(ref int scan, Span<byte> buffer)
355/// Form Encoding is not supported compared to the <see cref="DecodeRequestLine(ReadOnlySpan{byte}, Span{byte}, bool)" />
358public static int DecodeRequestLine(ReadOnlySpan<char> source, Span<char> destination)
374/// Form Encoding is not supported compared to the <see cref="DecodeInPlace(Span{byte}, bool)" />
377public static int DecodeInPlace(Span<char> buffer)
434private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<char> buffer)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (79)
src\Servers\Kestrel\shared\HPackHeaderWriter.cs (5)
20public static bool BeginEncodeHeaders(int statusCode, DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
51public static bool BeginEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
74public static bool ContinueEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
79private static bool EncodeStatusHeader(int statusCode, DynamicHPackEncoder hpackEncoder, Span<byte> buffer, out int length)
94private static bool EncodeHeadersCore(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (33)
src\Servers\Kestrel\shared\HPackHeaderWriter.cs (5)
20public static bool BeginEncodeHeaders(int statusCode, DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
51public static bool BeginEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
74public static bool ContinueEncodeHeaders(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, out int length)
79private static bool EncodeStatusHeader(int statusCode, DynamicHPackEncoder hpackEncoder, Span<byte> buffer, out int length)
94private static bool EncodeHeadersCore(DynamicHPackEncoder hpackEncoder, Http2HeadersEnumerator headersEnumerator, Span<byte> buffer, bool throwIfNoneEncoded, out int length)
Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes (5)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (10)
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets (5)
Microsoft.AspNetCore.Session (1)
Microsoft.AspNetCore.Shared.Tests (107)
src\Shared\Hpack\DynamicHPackEncoder.cs (3)
54public bool EnsureDynamicTableSizeUpdate(Span<byte> buffer, out int length)
68public bool EncodeHeader(Span<byte> buffer, int staticTableIndex, HeaderEncodingHint encodingHint, string name, string value,
117private bool EncodeDynamicHeader(Span<byte> buffer, int staticTableIndex, string name, string value,
src\Shared\runtime\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\Shared\runtime\Http3\QPack\QPackEncoder.cs (18)
23public static bool EncodeStaticIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
39Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
61public static bool EncodeLiteralHeaderFieldWithStaticNameReference(int index, string value, Span<byte> destination, out int bytesWritten)
66public static bool EncodeLiteralHeaderFieldWithStaticNameReference(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
89/// Encodes just the name part of a Literal Header Field With Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
93Span<byte> temp = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
104Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
125public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, string value, Span<byte> destination, out int bytesWritten)
130public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
147public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
160/// Encodes just the value part of a Literawl Header Field Without Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
164Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
174Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
182private static bool EncodeValueString(string s, Encoding? valueEncoding, Span<byte> buffer, out int length)
220public static bool EncodeValueString(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> buffer, out int length)
301private static void EncodeValueStringPart(string s, Span<byte> buffer)
316private static bool EncodeNameString(string s, Span<byte> buffer, out int length)
355private static bool EncodeHeaderBlockPrefix(Span<byte> destination, out int bytesWritten)
src\Shared\ServerInfrastructure\StringUtilities.cs (4)
53private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiOrUTF8StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
80private static readonly unsafe SpanAction<char, IntPtr> s_getAsciiStringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
106private static readonly unsafe SpanAction<char, IntPtr> s_getLatin1StringNonNullCharacters = (Span<char> buffer, IntPtr state) =>
482private static readonly SpanAction<char, (string? str, char separator, uint number)> s_populateSpanWithHexSuffix = (Span<char> buffer, (string? str, char separator, uint number) tuple) =>
src\Shared\UrlDecoder\UrlDecoder.cs (11)
18public static int DecodeRequestLine(ReadOnlySpan<byte> source, Span<byte> destination, bool isFormEncoding)
42public static int DecodeInPlace(Span<byte> buffer, bool isFormEncoding)
96private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<byte> buffer, bool isFormEncoding)
234private static void Copy<T>(int begin, int end, ref int writer, Span<T> buffer)
262private static int UnescapePercentEncoding(ref int scan, Span<byte> buffer, bool isFormEncoding)
301private static int ReadHex(ref int scan, Span<byte> buffer)
355/// Form Encoding is not supported compared to the <see cref="DecodeRequestLine(ReadOnlySpan{byte}, Span{byte}, bool)" />
358public static int DecodeRequestLine(ReadOnlySpan<char> source, Span<char> destination)
374/// Form Encoding is not supported compared to the <see cref="DecodeInPlace(Span{byte}, bool)" />
377public static int DecodeInPlace(Span<char> buffer)
434private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<char> buffer)
Microsoft.AspNetCore.SignalR.Client.Core (1)
Microsoft.AspNetCore.SignalR.Client.Tests (3)
Microsoft.AspNetCore.SignalR.Common (7)
Microsoft.AspNetCore.SignalR.Common.Tests (3)
Microsoft.AspNetCore.SignalR.Core (1)
Microsoft.AspNetCore.SignalR.Microbenchmarks (4)
Microsoft.AspNetCore.SignalR.Protocols.Json (5)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (5)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (7)
Microsoft.AspNetCore.SignalR.Specification.Tests (2)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (4)
Microsoft.AspNetCore.StaticAssets (1)
Microsoft.AspNetCore.StaticAssets.Tests (1)
Microsoft.AspNetCore.TestHost (1)
Microsoft.AspNetCore.WebSockets (15)
Microsoft.AspNetCore.WebUtilities (22)
src\Shared\UrlDecoder\UrlDecoder.cs (11)
18public static int DecodeRequestLine(ReadOnlySpan<byte> source, Span<byte> destination, bool isFormEncoding)
42public static int DecodeInPlace(Span<byte> buffer, bool isFormEncoding)
96private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<byte> buffer, bool isFormEncoding)
234private static void Copy<T>(int begin, int end, ref int writer, Span<T> buffer)
262private static int UnescapePercentEncoding(ref int scan, Span<byte> buffer, bool isFormEncoding)
301private static int ReadHex(ref int scan, Span<byte> buffer)
355/// Form Encoding is not supported compared to the <see cref="DecodeRequestLine(ReadOnlySpan{byte}, Span{byte}, bool)" />
358public static int DecodeRequestLine(ReadOnlySpan<char> source, Span<char> destination)
374/// Form Encoding is not supported compared to the <see cref="DecodeInPlace(Span{byte}, bool)" />
377public static int DecodeInPlace(Span<char> buffer)
434private static bool DecodeCore(ref int sourceIndex, ref int destinationIndex, Span<char> buffer)
Microsoft.AspNetCore.WebUtilities.Tests (2)
Microsoft.Build (12)
Microsoft.Build.Engine.OM.UnitTests (8)
Microsoft.Build.Framework (19)
ArraySortHelper.cs (19)
310int nanLeft = SegmentedArraySortUtils.MoveNansToFront(keys, default(Span<byte>));
669public static void Sort(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey>? comparer)
687private static void SwapIfGreaterWithValues(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey> comparer, int i, int j)
707private static void Swap(SegmentedArraySegment<TKey> keys, Span<TValue> values, int i, int j)
720internal static void IntrospectiveSort(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
731private static void IntroSort(SegmentedArraySegment<TKey> keys, Span<TValue> values, int depthLimit, IComparer<TKey> comparer)
777private static int PickPivotAndPartition(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
822private static void HeapSort(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
840private static void DownHeap(SegmentedArraySegment<TKey> keys, Span<TValue> values, int i, int n, int lo, IComparer<TKey> comparer)
869private static void InsertionSort(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
895public static void Sort(SegmentedArraySegment<TKey> keys, Span<TValue> values, IComparer<TKey>? comparer)
942private static void SwapIfGreaterWithValues(SegmentedArraySegment<TKey> keys, Span<TValue> values, int i, int j)
960private static void Swap(SegmentedArraySegment<TKey> keys, Span<TValue> values, int i, int j)
973private static void IntroSort(SegmentedArraySegment<TKey> keys, Span<TValue> values, int depthLimit)
1018private static int PickPivotAndPartition(SegmentedArraySegment<TKey> keys, Span<TValue> values)
1077private static void HeapSort(SegmentedArraySegment<TKey> keys, Span<TValue> values)
1094private static void DownHeap(SegmentedArraySegment<TKey> keys, Span<TValue> values, int i, int n, int lo)
1122private static void InsertionSort(SegmentedArraySegment<TKey> keys, Span<TValue> values)
1235public static int MoveNansToFront<TKey, TValue>(SegmentedArraySegment<TKey> keys, Span<TValue> values) where TKey : notnull
Microsoft.Build.Tasks.Core (8)
Microsoft.Build.Utilities.Core (8)
Microsoft.Extensions.Caching.Hybrid (1)
Microsoft.Extensions.Caching.Hybrid.Tests (1)
Microsoft.Extensions.Caching.MicroBenchmarks (1)
Microsoft.Extensions.DependencyInjection.Abstractions (6)
Microsoft.Extensions.Diagnostics (2)
Microsoft.Extensions.Identity.Core (3)
Microsoft.Extensions.Logging.Abstractions (8)
Microsoft.Extensions.Logging.Console (3)
Microsoft.Extensions.Logging.Generators (16)
Microsoft.Net.Http.Headers (4)
Microsoft.NET.WebAssembly.Webcil (1)
MSBuild (8)
mscorlib (1)
netstandard (1)
PresentationCore (3)
ReachFramework (1)
Sockets.FunctionalTests (2)
System.Collections (7)
System.Collections.Immutable (20)
System.ComponentModel.Annotations (1)
System.ComponentModel.TypeConverter (2)
System.Console (22)
System.Data.Common (35)
System\Data\SQLTypes\SQLDecimal.cs (25)
493Span<int> bits = stackalloc int[4];
930Span<uint> rgulNumeric = [_data1, _data2, _data3, _data4];
932Span<char> pszTmp = stackalloc char[s_NUMERIC_MAX_PRECISION + 1]; //Local Character buffer to hold
1158public int WriteTdsValue(Span<uint> destination)
1289Span<uint> rglData1 = [x._data1, x._data2, x._data3, x._data4];
1290Span<uint> rglData2 = [y._data1, y._data2, y._data3, y._data4];
1338Span<uint> rguiTemp = rglData2;
1481Span<uint> rgulRes = stackalloc uint[x_culNumeMultRes]; //new [] are already initialized to zero
1709Span<uint> rgulData1 = [x._data1, x._data2, x._data3, x._data4];
1710Span<uint> rgulData2 = [y._data1, y._data2, y._data3, y._data4];
1713Span<uint> rgulR = stackalloc uint[s_cNumeMax + 1];
1714Span<uint> rgulQ = stackalloc uint[s_cNumeMax];
1857private static void ZeroToMaxLen(Span<uint> rgulData, int cUI4sCur)
1931private static bool FGt10_38(Span<uint> rglData)
2088Span<uint> rgulU = [_data1, _data2, _data3, _data4];
2119Span<uint> rguiData = [_data1, _data2, _data3, _data4];
2164Span<uint> rguiData = [_data1, _data2, _data3, _data4];
2224Span<uint> rguiData = [_data1, _data2, _data3, _data4];
2458Span<uint> rgulD, // Out | Destination number
2474Span<uint> rgulD, // Out | Number
2499Span<uint> piulD, // InOut| D
2531Span<uint> rgulU, // InOut| U
2595Span<uint> rgulD, // InOut | D
2597Span<uint> rgulQ, // Out | Q
2599Span<uint> rgulR, // Out | R
System.Diagnostics.DiagnosticSource (38)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Diagnostics.FileVersionInfo (1)
System.Diagnostics.Process (18)
System.Diagnostics.TextWriterTraceListener (3)
System.Diagnostics.TraceSource (1)
System.Drawing.Primitives (1)
System.Formats.Asn1 (58)
System.Formats.Cbor (25)
System.Formats.Tar (58)
System.IO.Compression (13)
System.IO.Compression.Brotli (11)
System\IO\Compression\enc\BrotliEncoder.cs (5)
134public OperationStatus Flush(Span<byte> destination, out int bytesWritten) => Compress(ReadOnlySpan<byte>.Empty, destination, out _, out bytesWritten, BrotliEncoderOperation.Flush);
145public OperationStatus Compress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock) => Compress(source, destination, out bytesConsumed, out bytesWritten, isFinalBlock ? BrotliEncoderOperation.Finish : BrotliEncoderOperation.Process);
147internal OperationStatus Compress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesConsumed, out int bytesWritten, BrotliEncoderOperation operation)
197public static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten) => TryCompress(source, destination, out bytesWritten, BrotliUtils.Quality_Default, BrotliUtils.WindowBits_Default);
206public static bool TryCompress(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten, int quality, int window)
System.IO.FileSystem.Watcher (8)
System.IO.Hashing (28)
System.IO.IsolatedStorage (1)
System.IO.MemoryMappedFiles (1)
System.IO.Pipelines (14)
System.IO.Pipes (2)
System.Linq (22)
System\Linq\Select.SpeedOpt.cs (6)
158private static void Fill(ReadOnlySpan<TSource> source, Span<TResult> destination, Func<TSource, TResult> func)
284private static void Fill(Span<TResult> results, int start, Func<int, TResult> func)
384private static void Fill(ReadOnlySpan<TSource> source, Span<TResult> destination, Func<TSource, TResult> func)
487private static void Fill(IList<TSource> source, Span<TResult> results, Func<TSource, TResult> func)
725private static void Fill(Iterator<TSource> source, Span<TResult> results, Func<TSource, TResult> func)
900private static void Fill(IList<TSource> source, Span<TResult> destination, Func<TSource, TResult> func, int sourceIndex)
System.Linq.Expressions (1)
System.Memory (27)
System.Memory.Data (2)
System.Net.Http (110)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackEncoder.cs (22)
25public static bool EncodeIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
45public static bool EncodeStatusHeader(int statusCode, Span<byte> destination, out int bytesWritten)
77public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
109public static bool EncodeLiteralHeaderFieldNeverIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
141public static bool EncodeLiteralHeaderFieldIndexing(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
176public static bool EncodeLiteralHeaderFieldWithoutIndexing(int index, Span<byte> destination, out int bytesWritten)
208public static bool EncodeLiteralHeaderFieldIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
229public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
250public static bool EncodeLiteralHeaderFieldNeverIndexingNewName(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
270private static bool EncodeLiteralHeaderNewNameCore(byte mask, string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
288public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
324public static bool EncodeLiteralHeaderFieldWithoutIndexingNewName(string name, Span<byte> destination, out int bytesWritten)
358private static bool EncodeLiteralHeaderName(string value, Span<byte> destination, out int bytesWritten)
395private static void EncodeValueStringPart(string value, Span<byte> destination)
410public static bool EncodeStringLiteral(ReadOnlySpan<byte> value, Span<byte> destination, out int bytesWritten)
444public static bool EncodeStringLiteral(string value, Span<byte> destination, out int bytesWritten)
449public static bool EncodeStringLiteral(string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
494public static bool EncodeDynamicTableSizeUpdate(int value, Span<byte> destination, out int bytesWritten)
513public static bool EncodeStringLiterals(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
601Span<byte> span = stackalloc byte[256];
613Span<byte> span = stackalloc byte[256];
622Span<byte> span =
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackEncoder.cs (18)
23public static bool EncodeStaticIndexedHeaderField(int index, Span<byte> destination, out int bytesWritten)
39Span<byte> buffer = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
61public static bool EncodeLiteralHeaderFieldWithStaticNameReference(int index, string value, Span<byte> destination, out int bytesWritten)
66public static bool EncodeLiteralHeaderFieldWithStaticNameReference(int index, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
89/// Encodes just the name part of a Literal Header Field With Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
93Span<byte> temp = stackalloc byte[IntegerEncoder.MaxInt32EncodedLength];
104Span<byte> temp = value.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
125public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, string value, Span<byte> destination, out int bytesWritten)
130public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, string value, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
147public static bool EncodeLiteralHeaderFieldWithoutNameReference(string name, ReadOnlySpan<string> values, byte[] separator, Encoding? valueEncoding, Span<byte> destination, out int bytesWritten)
160/// Encodes just the value part of a Literawl Header Field Without Static Name Reference. Must call <see cref="EncodeValueString(string, Encoding?, Span{byte}, out int)"/> after to encode the header's value.
164Span<byte> temp = name.Length < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength] : new byte[name.Length + IntegerEncoder.MaxInt32EncodedLength];
174Span<byte> temp = (name.Length + value.Length) < 256 ? stackalloc byte[256 + IntegerEncoder.MaxInt32EncodedLength * 2] : new byte[name.Length + value.Length + IntegerEncoder.MaxInt32EncodedLength * 2];
182private static bool EncodeValueString(string s, Encoding? valueEncoding, Span<byte> buffer, out int length)
220public static bool EncodeValueString(ReadOnlySpan<string> values, byte[]? separator, Encoding? valueEncoding, Span<byte> buffer, out int length)
301private static void EncodeValueStringPart(string s, Span<byte> buffer)
316private static bool EncodeNameString(string s, Span<byte> buffer, out int length)
355private static bool EncodeHeaderBlockPrefix(Span<byte> destination, out int bytesWritten)
System.Net.HttpListener (6)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Net.Mail (15)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Net.NameResolution (9)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (9)
73public static unsafe void SetAddressFamily(Span<byte> buffer, AddressFamily family)
101public static unsafe void SetPort(Span<byte> buffer, ushort port)
125public static unsafe void GetIPv6Address(ReadOnlySpan<byte> buffer, Span<byte> address, out uint scope)
139public static unsafe void SetIPv4Address(Span<byte> buffer, uint address)
150public static unsafe void SetIPv4Address(Span<byte> buffer, byte* address)
156public static unsafe void SetIPv6Address(Span<byte> buffer, Span<byte> address, uint scope)
165public static unsafe void SetIPv6Address(Span<byte> buffer, byte* address, int addressLength, uint scope)
176public static unsafe void Clear(Span<byte> buffer)
System.Net.NetworkInformation (8)
System.Net.Ping (19)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (9)
73public static unsafe void SetAddressFamily(Span<byte> buffer, AddressFamily family)
101public static unsafe void SetPort(Span<byte> buffer, ushort port)
125public static unsafe void GetIPv6Address(ReadOnlySpan<byte> buffer, Span<byte> address, out uint scope)
139public static unsafe void SetIPv4Address(Span<byte> buffer, uint address)
150public static unsafe void SetIPv4Address(Span<byte> buffer, byte* address)
156public static unsafe void SetIPv6Address(Span<byte> buffer, Span<byte> address, uint scope)
165public static unsafe void SetIPv6Address(Span<byte> buffer, byte* address, int addressLength, uint scope)
176public static unsafe void Clear(Span<byte> buffer)
System.Net.Primitives (48)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (9)
73public static unsafe void SetAddressFamily(Span<byte> buffer, AddressFamily family)
101public static unsafe void SetPort(Span<byte> buffer, ushort port)
125public static unsafe void GetIPv6Address(ReadOnlySpan<byte> buffer, Span<byte> address, out uint scope)
139public static unsafe void SetIPv4Address(Span<byte> buffer, uint address)
150public static unsafe void SetIPv4Address(Span<byte> buffer, byte* address)
156public static unsafe void SetIPv6Address(Span<byte> buffer, Span<byte> address, uint scope)
165public static unsafe void SetIPv6Address(Span<byte> buffer, byte* address, int addressLength, uint scope)
176public static unsafe void Clear(Span<byte> buffer)
System\Net\IPAddress.cs (10)
273public bool TryWriteBytes(Span<byte> destination, out int bytesWritten)
302private void WriteIPv6Bytes(Span<byte> destination)
330private void WriteIPv4Bytes(Span<byte> destination)
411Span<char> span = stackalloc char[IPAddressParser.MaxIPv6StringLength];
426public bool TryFormat(Span<char> destination, out int charsWritten) =>
433public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten) =>
437bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
442bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
446private bool TryFormatCore<TChar>(Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IBinaryInteger<TChar>
465Span<TChar> tmpDestination = stackalloc TChar[IPAddressParser.MaxIPv6StringLength];
System\Net\IPAddressParser.cs (9)
25Span<ushort> numbers = stackalloc ushort[IPAddressParserStatics.IPv6AddressShorts];
68private static unsafe bool TryParseIPv6(ReadOnlySpan<char> ipSpan, Span<ushort> numbers, int numbersLength, out uint scope)
110internal static int FormatIPv4Address<TChar>(uint address, Span<TChar> addressString) where TChar : unmanaged, IBinaryInteger<TChar>
125static int FormatByte(uint number, Span<TChar> addressString)
154internal static int FormatIPv6Address<TChar>(ushort[] address, uint scopeId, Span<TChar> destination) where TChar : unmanaged, IBinaryInteger<TChar>
183Span<TChar> chars = stackalloc TChar[10];
191Span<TChar> used = chars.Slice(bytesPos);
201static void AppendSections(ReadOnlySpan<ushort> address, Span<TChar> destination, ref int offset)
240static void AppendHex(ushort value, Span<TChar> destination, ref int offset)
System.Net.Quic (52)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (9)
73public static unsafe void SetAddressFamily(Span<byte> buffer, AddressFamily family)
101public static unsafe void SetPort(Span<byte> buffer, ushort port)
125public static unsafe void GetIPv6Address(ReadOnlySpan<byte> buffer, Span<byte> address, out uint scope)
139public static unsafe void SetIPv4Address(Span<byte> buffer, uint address)
150public static unsafe void SetIPv4Address(Span<byte> buffer, byte* address)
156public static unsafe void SetIPv6Address(Span<byte> buffer, Span<byte> address, uint scope)
165public static unsafe void SetIPv6Address(Span<byte> buffer, byte* address, int addressLength, uint scope)
176public static unsafe void Clear(Span<byte> buffer)
System.Net.Requests (3)
System.Net.Security (83)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.SslCtx.cs (1)
40internal static unsafe partial int SslCtxSetCaching(SafeSslContextHandle ctx, int mode, int cacheSize, int contextIdLength, Span<byte> contextId, delegate* unmanaged<IntPtr, IntPtr, int> neewSessionCallback, delegate* unmanaged<IntPtr, IntPtr, void> removeSessionCallback);
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
src\libraries\Common\src\System\Net\Security\MD4.cs (14)
63internal static void HashData(ReadOnlySpan<byte> source, Span<byte> destination)
67Span<byte> buffer = stackalloc byte[64];
70Span<uint> state = stackalloc uint[4] { 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476 };
71Span<uint> count = stackalloc uint[2] { 0, 0 };
76Span<byte> bits = stackalloc byte[8];
82Span<byte> padding = stackalloc byte[padLen];
94private static void HashCore(ReadOnlySpan<byte> input, Span<uint> state, Span<uint> count, Span<byte> buffer)
171private static void Encode(Span<byte> output, Span<uint> input)
179private static void Decode(Span<uint> output, ReadOnlySpan<byte> input)
187private static void MD4Transform(Span<uint> state, ReadOnlySpan<byte> block)
193Span<uint> x = stackalloc uint[16];
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (26)
295private static unsafe void CreateNtlmNegotiateMessage(Span<byte> asBytes, Flags requiredFlags)
341Span<byte> span = MemoryMarshal.AsBytes(new Span<MessageField>(ref field));
347private static void AddToPayload(ref MessageField field, ReadOnlySpan<byte> data, Span<byte> payload, ref int offset)
354private static void AddToPayload(ref MessageField field, ReadOnlySpan<char> data, Span<byte> payload, ref int offset)
365private static void makeNtlm2Hash(string domain, string userName, ReadOnlySpan<char> password, Span<byte> hash)
374Span<byte> pwHash = stackalloc byte[DigestLength];
375Span<byte> pwBytes = stackalloc byte[Encoding.Unicode.GetByteCount(password)];
398private unsafe void makeNtlm2ChallengeResponse(DateTime time, ReadOnlySpan<byte> ntlm2hash, ReadOnlySpan<byte> serverChallenge, Span<byte> clientChallenge, ReadOnlySpan<byte> serverInfo, ref MessageField field, Span<byte> payload, ref int payloadOffset)
404Span<byte> blob = payload.Slice(payloadOffset, sizeof(NtChallengeResponse) + serverInfo.Length);
429private unsafe void WriteChannelBindingHash(Span<byte> hashBuffer)
440Span<byte> prefix = stackalloc byte[sizeof(uint) * 5];
620Span<byte> responseAsSpan = new Span<byte>(responseBytes);
624Span<byte> payload = responseAsSpan;
635Span<byte> ntlm2hash = stackalloc byte[DigestLength];
639Span<byte> clientChallenge = stackalloc byte[ChallengeLength];
657Span<byte> exportedSessionKey = stackalloc byte[16];
664Span<byte> sessionBaseKey = stackalloc byte[HMACMD5.HashSizeInBytes];
671Span<byte> encryptedRandomSessionKey = payload.Slice(payloadOffset, 16);
718Span<byte> signature)
726Span<byte> hmacResult = stackalloc byte[hmac.HashLengthInBytes];
743Span<byte> expectedSignature = stackalloc byte[SignatureLength];
756Span<byte> signatureBuffer = signature.GetSpan(SignatureLength);
769Span<byte> output = outputWriter.GetSpan(input.Length + SignatureLength);
794Span<byte> output = outputWriter.GetSpan(input.Length - SignatureLength);
807public override NegotiateAuthenticationStatusCode UnwrapInPlace(Span<byte> input, out int unwrappedOffset, out int unwrappedLength, out bool wasEncrypted)
System.Net.Sockets (64)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (9)
73public static unsafe void SetAddressFamily(Span<byte> buffer, AddressFamily family)
101public static unsafe void SetPort(Span<byte> buffer, ushort port)
125public static unsafe void GetIPv6Address(ReadOnlySpan<byte> buffer, Span<byte> address, out uint scope)
139public static unsafe void SetIPv4Address(Span<byte> buffer, uint address)
150public static unsafe void SetIPv4Address(Span<byte> buffer, byte* address)
156public static unsafe void SetIPv6Address(Span<byte> buffer, Span<byte> address, uint scope)
165public static unsafe void SetIPv6Address(Span<byte> buffer, byte* address, int addressLength, uint scope)
176public static unsafe void Clear(Span<byte> buffer)
System\Net\Sockets\Socket.cs (15)
141Span<byte> buffer = stackalloc byte[SocketPal.MaximumAddressSize];
164Span<byte> address = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes];
196Span<byte> address = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes];
301Span<byte> buffer = stackalloc byte[SocketAddress.GetMaximumAddressSize(_addressFamily)];
349Span<byte> buffer = stackalloc byte[SocketAddress.GetMaximumAddressSize(_addressFamily)];
1474public int Receive(Span<byte> buffer) => Receive(buffer, SocketFlags.None);
1476public int Receive(Span<byte> buffer, SocketFlags socketFlags)
1484public int Receive(Span<byte> buffer, SocketFlags socketFlags, out SocketError errorCode)
1617/// An <see cref="Span{T}"/> of type <see cref="byte"/> that is the storage location for received data.
1634/// <see cref="Socket.ReceiveMessageFrom(Span{byte}, ref SocketFlags, ref EndPoint, out IPPacketInformation)"/>
1639public int ReceiveMessageFrom(Span<byte> buffer, ref SocketFlags socketFlags, ref EndPoint remoteEP, out IPPacketInformation ipPacketInformation)
1802public int ReceiveFrom(Span<byte> buffer, ref EndPoint remoteEP)
1817public int ReceiveFrom(Span<byte> buffer, SocketFlags socketFlags, ref EndPoint remoteEP)
1898public int ReceiveFrom(Span<byte> buffer, SocketFlags socketFlags, SocketAddress receivedAddress)
2171public int GetRawSocketOption(int optionLevel, int optionName, Span<byte> optionValue)
System\Net\Sockets\SocketAsyncContext.Unix.cs (4)
513bool completed = SocketPal.TryCompleteReceiveFrom(context._socket, default(Span<byte>), Buffers, Flags, SocketAddress.Span, out int socketAddressLen, out BytesTransferred, out ReceivedFlags, out ErrorCode);
1544public SocketError Receive(Span<byte> buffer, SocketFlags flags, int timeout, out int bytesReceived)
1585public unsafe SocketError ReceiveFrom(Span<byte> buffer, ref SocketFlags flags, Memory<byte> socketAddress, out int socketAddressLen, int timeout, out int bytesReceived)
1797Span<byte> buffer, ref SocketFlags flags, Memory<byte> socketAddress, out int socketAddressLen, bool isIPv4, bool isIPv6, int timeout, out IPPacketInformation ipPacketInformation, out int bytesReceived)
System\Net\Sockets\SocketPal.Unix.cs (29)
102private static unsafe int SysRead(SafeSocketHandle handle, Span<byte> buffer, out Interop.Error errno)
117private static unsafe int SysReceive(SafeSocketHandle socket, SocketFlags flags, Span<byte> buffer, out Interop.Error errno)
141private static unsafe int SysReceive(SafeSocketHandle socket, SocketFlags flags, Span<byte> buffer, Span<byte> socketAddress, out int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno)
291Span<GCHandle> handles = allocOnStack ? stackalloc GCHandle[IovStackThreshold] : new GCHandle[maxBuffers];
292Span<Interop.Sys.IOVector> iovecs = allocOnStack ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[maxBuffers];
372private static unsafe int SysReceive(SafeSocketHandle socket, SocketFlags flags, IList<ArraySegment<byte>> buffers, Span<byte> socketAddress, out int socketAddressLen, out SocketFlags receivedFlags, out Interop.Error errno)
398Span<GCHandle> handles = allocOnStack ? stackalloc GCHandle[IovStackThreshold] : new GCHandle[maxBuffers];
399Span<Interop.Sys.IOVector> iovecs = allocOnStack ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[maxBuffers];
470private static unsafe int SysReceiveMessageFrom(SafeSocketHandle socket, SocketFlags flags, Span<byte> buffer, Span<byte> socketAddress, out int socketAddressLen, bool isIPv4, bool isIPv6, out SocketFlags receivedFlags, out IPPacketInformation ipPacketInformation, out Interop.Error errno)
527Span<byte> socketAddress, out int socketAddressLen, bool isIPv4, bool isIPv6,
534Span<GCHandle> handles = allocOnStack ? stackalloc GCHandle[IovStackThreshold] : new GCHandle[buffersCount];
535Span<Interop.Sys.IOVector> iovecs = allocOnStack ? stackalloc Interop.Sys.IOVector[IovStackThreshold] : new Interop.Sys.IOVector[buffersCount];
736public static bool TryCompleteReceiveFrom(SafeSocketHandle socket, Span<byte> buffer, SocketFlags flags, Span<byte> socketAddress, out int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) =>
739public static bool TryCompleteReceiveFrom(SafeSocketHandle socket, IList<ArraySegment<byte>> buffers, SocketFlags flags, Span<byte> socketAddress, out int socketAddressLen, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode) =>
740TryCompleteReceiveFrom(socket, default(Span<byte>), buffers, flags, socketAddress, out socketAddressLen, out bytesReceived, out receivedFlags, out errorCode);
742public static unsafe bool TryCompleteReceive(SafeSocketHandle socket, Span<byte> buffer, SocketFlags flags, out int bytesReceived, out SocketError errorCode)
801public static unsafe bool TryCompleteReceiveFrom(SafeSocketHandle socket, Span<byte> buffer, IList<ArraySegment<byte>>? buffers, SocketFlags flags, Span<byte> socketAddress, out int receivedSocketAddressLength, out int bytesReceived, out SocketFlags receivedFlags, out SocketError errorCode)
872public static unsafe bool TryCompleteReceiveMessageFrom(SafeSocketHandle socket, Span<byte> buffer, IList<ArraySegment<byte>>? buffers, SocketFlags flags, Memory<byte> socketAddress, out int receivedSocketAddressLength, bool isIPv4, bool isIPv6, out int bytesReceived, out SocketFlags receivedFlags, out IPPacketInformation ipPacketInformation, out SocketError errorCode)
918public static bool TryCompleteSendTo(SafeSocketHandle socket, Span<byte> buffer, ref int offset, ref int count, SocketFlags flags, ReadOnlySpan<byte> socketAddress, ref int bytesSent, out SocketError errorCode)
1074public static unsafe SocketError GetPeerName(SafeSocketHandle handle, Span<byte> buffer, ref int nameLen)
1238if (!TryCompleteReceiveFrom(handle, buffers, socketFlags, Span<byte>.Empty, out int _, out bytesTransferred, out _, out errorCode))
1259public static SocketError Receive(SafeSocketHandle handle, Span<byte> buffer, SocketFlags socketFlags, out int bytesTransferred)
1297public static SocketError ReceiveMessageFrom(Socket socket, SafeSocketHandle handle, Span<byte> buffer, ref SocketFlags socketFlags, SocketAddress socketAddress, out SocketAddress receiveAddress, out IPPacketInformation ipPacketInformation, out int bytesTransferred)
1334public static SocketError ReceiveFrom(SafeSocketHandle handle, Span<byte> buffer, SocketFlags socketFlags, Memory<byte> socketAddress, out int socketAddressLen, out int bytesTransferred)
1628public static unsafe SocketError GetRawSockOpt(SafeSocketHandle handle, int optionLevel, int optionName, Span<byte> optionValue, ref int optionLength)
System.Net.WebClient (6)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Net.WebProxy (1)
System.Net.WebSockets (12)
System.Net.WebSockets.Client (1)
System.Numerics.Tensors (190)
System\Numerics\Tensors\netcore\TensorPrimitives.MultiplyAddEstimate.cs (9)
31/// Behaves the same as either <see cref="MultiplyAdd{T}(ReadOnlySpan{T}, ReadOnlySpan{T}, ReadOnlySpan{T}, Span{T})"/> or
32/// <see cref="FusedMultiplyAdd{T}(ReadOnlySpan{T}, ReadOnlySpan{T}, ReadOnlySpan{T}, Span{T})"/> depending on the current machine's capabilities.
35public static void MultiplyAddEstimate<T>(ReadOnlySpan<T> x, ReadOnlySpan<T> y, ReadOnlySpan<T> addend, Span<T> destination)
57/// Behaves the same as either <see cref="MultiplyAdd{T}(ReadOnlySpan{T}, ReadOnlySpan{T}, T, Span{T})"/> or
58/// <see cref="FusedMultiplyAdd{T}(ReadOnlySpan{T}, ReadOnlySpan{T}, T, Span{T})"/> depending on the current machine's capabilities.
61public static void MultiplyAddEstimate<T>(ReadOnlySpan<T> x, ReadOnlySpan<T> y, T addend, Span<T> destination)
82/// Behaves the same as either <see cref="MultiplyAdd{T}(ReadOnlySpan{T}, T, ReadOnlySpan{T}, Span{T})"/> or
83/// <see cref="FusedMultiplyAdd{T}(ReadOnlySpan{T}, T, ReadOnlySpan{T}, Span{T})"/> depending on the current machine's capabilities.
86public static void MultiplyAddEstimate<T>(ReadOnlySpan<T> x, T y, ReadOnlySpan<T> addend, Span<T> destination)
System\Numerics\Tensors\netcore\TensorPrimitives.Single.netcore.cs (7)
45ReadOnlySpan<float> x, Span<float> destination)
50ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination)
55ReadOnlySpan<float> x, float y, Span<float> destination)
60ReadOnlySpan<float> x, float y, Span<float> destination)
66ReadOnlySpan<float> x, ReadOnlySpan<float> y, ReadOnlySpan<float> z, Span<float> destination)
71ReadOnlySpan<float> x, ReadOnlySpan<float> y, float z, Span<float> destination)
76ReadOnlySpan<float> x, float y, ReadOnlySpan<float> z, Span<float> destination)
System\Numerics\Tensors\TensorPrimitives.Single.cs (28)
29public static void Abs(ReadOnlySpan<float> x, Span<float> destination) =>
48public static void Add(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
65public static void Add(ReadOnlySpan<float> x, float y, Span<float> destination) =>
86public static void AddMultiply(ReadOnlySpan<float> x, ReadOnlySpan<float> y, ReadOnlySpan<float> multiplier, Span<float> destination) =>
106public static void AddMultiply(ReadOnlySpan<float> x, ReadOnlySpan<float> y, float multiplier, Span<float> destination) =>
126public static void AddMultiply(ReadOnlySpan<float> x, float y, ReadOnlySpan<float> multiplier, Span<float> destination) =>
150public static void Cosh(ReadOnlySpan<float> x, Span<float> destination) =>
225public static void Divide(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
242public static void Divide(ReadOnlySpan<float> x, float y, Span<float> destination) =>
289public static void Exp(ReadOnlySpan<float> x, Span<float> destination) =>
378public static void Log(ReadOnlySpan<float> x, Span<float> destination) =>
401public static void Log2(ReadOnlySpan<float> x, Span<float> destination) =>
442public static void Max(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
478public static void MaxMagnitude(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
519public static void Min(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
560public static void MinMagnitude(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
579public static void Multiply(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
597public static void Multiply(ReadOnlySpan<float> x, float y, Span<float> destination) =>
618public static void MultiplyAdd(ReadOnlySpan<float> x, ReadOnlySpan<float> y, ReadOnlySpan<float> addend, Span<float> destination) =>
639public static void MultiplyAdd(ReadOnlySpan<float> x, ReadOnlySpan<float> y, float addend, Span<float> destination) =>
659public static void MultiplyAdd(ReadOnlySpan<float> x, float y, ReadOnlySpan<float> addend, Span<float> destination) =>
675public static void Negate(ReadOnlySpan<float> x, Span<float> destination) =>
798public static void Sigmoid(ReadOnlySpan<float> x, Span<float> destination)
829public static void Sinh(ReadOnlySpan<float> x, Span<float> destination) =>
848public static void SoftMax(ReadOnlySpan<float> x, Span<float> destination)
883public static void Subtract(ReadOnlySpan<float> x, ReadOnlySpan<float> y, Span<float> destination) =>
900public static void Subtract(ReadOnlySpan<float> x, float y, Span<float> destination) =>
982public static void Tanh(ReadOnlySpan<float> x, Span<float> destination) =>
System.Private.CoreLib (1088)
src\libraries\Common\src\System\HexConverter.cs (7)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
112private static void EncodeToUtf16_Vector128(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
245public static bool TryDecodeFromUtf16_Vector128(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
src\libraries\System.Private.CoreLib\src\System\Array.cs (7)
2107Span<T> keysSpan = UnsafeArrayAsSpan<T>(keys, adjustedIndex, length);
2130var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2179var span = new Span<T>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(array), index), length);
2203var spanKeys = new Span<TKey>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(keys), index), length);
2204var spanItems = new Span<TValue>(ref Unsafe.Add(ref MemoryMarshal.GetArrayDataReference(items), index), length);
2221var span = new Span<T>(ref MemoryMarshal.GetArrayDataReference(array), array.Length);
2691private static Span<T> UnsafeArrayAsSpan<T>(Array array, int adjustedIndex, int length) =>
src\libraries\System.Private.CoreLib\src\System\BitConverter.cs (14)
45public static bool TryWriteBytes(Span<byte> destination, bool value)
72public static bool TryWriteBytes(Span<byte> destination, char value)
99public static bool TryWriteBytes(Span<byte> destination, short value)
126public static bool TryWriteBytes(Span<byte> destination, int value)
153public static bool TryWriteBytes(Span<byte> destination, long value)
180public static bool TryWriteBytes(Span<byte> destination, Int128 value)
209public static bool TryWriteBytes(Span<byte> destination, ushort value)
238public static bool TryWriteBytes(Span<byte> destination, uint value)
267public static bool TryWriteBytes(Span<byte> destination, ulong value)
296public static bool TryWriteBytes(Span<byte> destination, UInt128 value)
323public static unsafe bool TryWriteBytes(Span<byte> destination, Half value)
350public static bool TryWriteBytes(Span<byte> destination, float value)
377public static bool TryWriteBytes(Span<byte> destination, double value)
808var dst = new Span<char>(ref result.GetRawStringData(), result.Length);
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (20)
201public static void ReverseEndianness(ReadOnlySpan<ushort> source, Span<ushort> destination) =>
204/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
205public static void ReverseEndianness(ReadOnlySpan<short> source, Span<short> destination) =>
208/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
210public static void ReverseEndianness(ReadOnlySpan<uint> source, Span<uint> destination) =>
213/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
214public static void ReverseEndianness(ReadOnlySpan<int> source, Span<int> destination) =>
217/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
219public static void ReverseEndianness(ReadOnlySpan<ulong> source, Span<ulong> destination) =>
222/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
223public static void ReverseEndianness(ReadOnlySpan<long> source, Span<long> destination) =>
226/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
228public static void ReverseEndianness(ReadOnlySpan<nuint> source, Span<nuint> destination) =>
235/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
236public static void ReverseEndianness(ReadOnlySpan<nint> source, Span<nint> destination) =>
285private static void ReverseEndianness<T, TReverser>(ReadOnlySpan<T> source, Span<T> destination)
373/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
375public static void ReverseEndianness(ReadOnlySpan<UInt128> source, Span<UInt128> destination) =>
378/// <inheritdoc cref="ReverseEndianness(ReadOnlySpan{ushort}, Span{ushort})" />
379public static void ReverseEndianness(ReadOnlySpan<Int128> source, Span<Int128> destination)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (26)
21public static void WriteDoubleBigEndian(Span<byte> destination, double value)
44public static void WriteHalfBigEndian(Span<byte> destination, Half value)
67public static void WriteInt16BigEndian(Span<byte> destination, short value)
90public static void WriteInt32BigEndian(Span<byte> destination, int value)
113public static void WriteInt64BigEndian(Span<byte> destination, long value)
136public static void WriteInt128BigEndian(Span<byte> destination, Int128 value)
159public static void WriteIntPtrBigEndian(Span<byte> destination, nint value)
182public static void WriteSingleBigEndian(Span<byte> destination, float value)
206public static void WriteUInt16BigEndian(Span<byte> destination, ushort value)
230public static void WriteUInt32BigEndian(Span<byte> destination, uint value)
254public static void WriteUInt64BigEndian(Span<byte> destination, ulong value)
278public static void WriteUInt128BigEndian(Span<byte> destination, UInt128 value)
302public static void WriteUIntPtrBigEndian(Span<byte> destination, nuint value)
325public static bool TryWriteDoubleBigEndian(Span<byte> destination, double value)
346public static bool TryWriteHalfBigEndian(Span<byte> destination, Half value)
367public static bool TryWriteInt16BigEndian(Span<byte> destination, short value)
388public static bool TryWriteInt32BigEndian(Span<byte> destination, int value)
409public static bool TryWriteInt64BigEndian(Span<byte> destination, long value)
430public static bool TryWriteInt128BigEndian(Span<byte> destination, Int128 value)
451public static bool TryWriteIntPtrBigEndian(Span<byte> destination, nint value)
472public static bool TryWriteSingleBigEndian(Span<byte> destination, float value)
494public static bool TryWriteUInt16BigEndian(Span<byte> destination, ushort value)
516public static bool TryWriteUInt32BigEndian(Span<byte> destination, uint value)
538public static bool TryWriteUInt64BigEndian(Span<byte> destination, ulong value)
560public static bool TryWriteUInt128BigEndian(Span<byte> destination, UInt128 value)
582public static bool TryWriteUIntPtrBigEndian(Span<byte> destination, nuint value)
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (26)
21public static void WriteDoubleLittleEndian(Span<byte> destination, double value)
44public static void WriteHalfLittleEndian(Span<byte> destination, Half value)
67public static void WriteInt16LittleEndian(Span<byte> destination, short value)
90public static void WriteInt32LittleEndian(Span<byte> destination, int value)
113public static void WriteInt64LittleEndian(Span<byte> destination, long value)
136public static void WriteInt128LittleEndian(Span<byte> destination, Int128 value)
159public static void WriteIntPtrLittleEndian(Span<byte> destination, nint value)
182public static void WriteSingleLittleEndian(Span<byte> destination, float value)
206public static void WriteUInt16LittleEndian(Span<byte> destination, ushort value)
230public static void WriteUInt32LittleEndian(Span<byte> destination, uint value)
254public static void WriteUInt64LittleEndian(Span<byte> destination, ulong value)
278public static void WriteUInt128LittleEndian(Span<byte> destination, UInt128 value)
302public static void WriteUIntPtrLittleEndian(Span<byte> destination, nuint value)
325public static bool TryWriteDoubleLittleEndian(Span<byte> destination, double value)
346public static bool TryWriteHalfLittleEndian(Span<byte> destination, Half value)
367public static bool TryWriteInt16LittleEndian(Span<byte> destination, short value)
388public static bool TryWriteInt32LittleEndian(Span<byte> destination, int value)
409public static bool TryWriteInt64LittleEndian(Span<byte> destination, long value)
430public static bool TryWriteInt128LittleEndian(Span<byte> destination, Int128 value)
451public static bool TryWriteIntPtrLittleEndian(Span<byte> destination, nint value)
472public static bool TryWriteSingleLittleEndian(Span<byte> destination, float value)
494public static bool TryWriteUInt16LittleEndian(Span<byte> destination, ushort value)
516public static bool TryWriteUInt32LittleEndian(Span<byte> destination, uint value)
538public static bool TryWriteUInt64LittleEndian(Span<byte> destination, ulong value)
560public static bool TryWriteUInt128LittleEndian(Span<byte> destination, UInt128 value)
582public static bool TryWriteUIntPtrLittleEndian(Span<byte> destination, nuint value)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Decoder.cs (9)
37public static OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> utf8, Span<byte> bytes, out int bytesConsumed, out int bytesWritten, bool isFinalBlock = true) =>
40private static unsafe OperationStatus DecodeFromUtf8(ReadOnlySpan<byte> utf8, Span<byte> bytes, out int bytesConsumed, out int bytesWritten, bool isFinalBlock, bool ignoreWhiteSpace)
282static OperationStatus InvalidDataFallback(ReadOnlySpan<byte> utf8, Span<byte> bytes, ref int bytesConsumed, ref int bytesWritten, bool isFinalBlock)
365public static OperationStatus DecodeFromUtf8InPlace(Span<byte> buffer, out int bytesWritten) =>
368private static unsafe OperationStatus DecodeFromUtf8InPlace(Span<byte> buffer, out int bytesWritten, bool ignoreWhiteSpace)
473private static OperationStatus DecodeWithWhiteSpaceBlockwise(ReadOnlySpan<byte> utf8, Span<byte> bytes, ref int bytesConsumed, ref int bytesWritten, bool isFinalBlock = true)
476Span<byte> buffer = stackalloc byte[BlockSize];
571private static OperationStatus DecodeWithWhiteSpaceFromUtf8InPlace(Span<byte> utf8, ref int destIndex, uint sourceIndex)
574Span<byte> buffer = stackalloc byte[BlockSize];
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Formatter\Utf8Formatter.Integer.cs (9)
34public static bool TryFormat(byte value, Span<byte> destination, out int bytesWritten, StandardFormat format = default) =>
59public static bool TryFormat(sbyte value, Span<byte> destination, out int bytesWritten, StandardFormat format = default) =>
84public static bool TryFormat(ushort value, Span<byte> destination, out int bytesWritten, StandardFormat format = default) =>
108public static bool TryFormat(short value, Span<byte> destination, out int bytesWritten, StandardFormat format = default) =>
134public static bool TryFormat(uint value, Span<byte> destination, out int bytesWritten, StandardFormat format = default)
186public static bool TryFormat(int value, Span<byte> destination, out int bytesWritten, StandardFormat format = default) =>
190private static bool TryFormat(int value, int hexMask, Span<byte> destination, out int bytesWritten, StandardFormat format = default)
248public static bool TryFormat(ulong value, Span<byte> destination, out int bytesWritten, StandardFormat format = default)
301public static bool TryFormat(long value, Span<byte> destination, out int bytesWritten, StandardFormat format = default)
src\libraries\System.Private.CoreLib\src\System\Byte.cs (6)
162public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
168public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
368/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
369bool IBinaryInteger<byte>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
386/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
387bool IBinaryInteger<byte>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Char.cs (6)
177bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
191bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
1281/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
1282bool IBinaryInteger<char>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
1299/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
1300bool IBinaryInteger<char>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ArraySortHelper.cs (53)
19public void Sort(Span<T> keys, IComparer<T>? comparer)
54internal static void Sort(Span<T> keys, Comparison<T> comparer)
99private static void SwapIfGreater(Span<T> keys, Comparison<T> comparer, int i, int j)
112private static void Swap(Span<T> a, int i, int j)
121internal static void IntrospectiveSort(Span<T> keys, Comparison<T> comparer)
134private static void IntroSort(Span<T> keys, int depthLimit, Comparison<T> comparer)
179private static int PickPivotAndPartition(Span<T> keys, Comparison<T> comparer)
217private static void HeapSort(Span<T> keys, Comparison<T> comparer)
235private static void DownHeap(Span<T> keys, int i, int n, Comparison<T> comparer)
258private static void InsertionSort(Span<T> keys, Comparison<T> comparer)
283public void Sort(Span<T> keys, IComparer<T>? comparer)
298int nanLeft = SortUtils.MoveNansToFront(keys, default(Span<byte>));
411private static void IntroSort(Span<T> keys, int depthLimit)
458private static unsafe int PickPivotAndPartition(Span<T> keys)
508private static void HeapSort(Span<T> keys)
525private static void DownHeap(Span<T> keys, int i, int n)
546private static void InsertionSort(Span<T> keys)
616public void Sort(Span<TKey> keys, Span<TValue> values, IComparer<TKey>? comparer)
634private static void SwapIfGreaterWithValues(Span<TKey> keys, Span<TValue> values, IComparer<TKey> comparer, int i, int j)
654private static void Swap(Span<TKey> keys, Span<TValue> values, int i, int j)
667internal static void IntrospectiveSort(Span<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
678private static void IntroSort(Span<TKey> keys, Span<TValue> values, int depthLimit, IComparer<TKey> comparer)
724private static int PickPivotAndPartition(Span<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
762private static void HeapSort(Span<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
780private static void DownHeap(Span<TKey> keys, Span<TValue> values, int i, int n, IComparer<TKey> comparer)
807private static void InsertionSort(Span<TKey> keys, Span<TValue> values, IComparer<TKey> comparer)
833public void Sort(Span<TKey> keys, Span<TValue> values, IComparer<TKey>? comparer)
877private static void SwapIfGreaterWithValues(Span<TKey> keys, Span<TValue> values, int i, int j)
895private static void Swap(Span<TKey> keys, Span<TValue> values, int i, int j)
908private static void IntroSort(Span<TKey> keys, Span<TValue> values, int depthLimit)
953private static int PickPivotAndPartition(Span<TKey> keys, Span<TValue> values)
998private static void HeapSort(Span<TKey> keys, Span<TValue> values)
1015private static void DownHeap(Span<TKey> keys, Span<TValue> values, int i, int n)
1040private static void InsertionSort(Span<TKey> keys, Span<TValue> values)
1112public static int MoveNansToFront<TKey, TValue>(Span<TKey> keys, Span<TValue> values) where TKey : notnull
src\libraries\System.Private.CoreLib\src\System\Convert.cs (11)
2300Span<char> chars = stackalloc char[22]; // max length of a ulong in octal
2429public static unsafe bool TryToBase64Chars(ReadOnlySpan<byte> bytes, Span<char> chars, out int charsWritten, Base64FormattingOptions options = Base64FormattingOptions.None)
2473private static unsafe void ToBase64CharsLargeNoLineBreaks(ReadOnlySpan<byte> bytes, Span<char> chars, int charLengthRequired)
2659public static bool TryFromBase64String(string s, Span<byte> bytes, out int bytesWritten)
2669public static bool TryFromBase64Chars(ReadOnlySpan<char> chars, Span<byte> bytes, out int bytesWritten)
2673Span<char> tempBuffer = stackalloc char[4]; // Note: The tempBuffer size could be made larger than 4 but the size must be a multiple of 4.
2763private static void CopyToTempBufferWithoutWhiteSpace(ReadOnlySpan<char> chars, Span<char> tempBuffer, out int consumed, out int charsWritten)
2971public static OperationStatus FromHexString(string source, Span<byte> destination, out int charsConsumed, out int bytesWritten)
2990public static OperationStatus FromHexString(ReadOnlySpan<char> source, Span<byte> destination, out int charsConsumed, out int bytesWritten)
3087public static bool TryToHexString(ReadOnlySpan<byte> source, Span<char> destination, out int charsWritten)
3164public static bool TryToHexStringLower(ReadOnlySpan<byte> source, Span<char> destination, out int charsWritten)
src\libraries\System.Private.CoreLib\src\System\Decimal.cs (13)
502public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
508public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
591public static int GetBits(decimal d, Span<int> destination)
612public static bool TryGetBits(decimal d, Span<int> destination, out int valuesWritten)
628internal static void GetBytes(in decimal d, Span<byte> buffer)
1144/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentBigEndian(Span{byte}, out int)" />
1145bool IFloatingPoint<decimal>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten)
1162/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentLittleEndian(Span{byte}, out int)" />
1163bool IFloatingPoint<decimal>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten)
1180/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandBigEndian(Span{byte}, out int)" />
1181bool IFloatingPoint<decimal>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten)
1209/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandLittleEndian(Span{byte}, out int)" />
1210bool IFloatingPoint<decimal>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Double.cs (10)
375public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
381public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
725/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentBigEndian(Span{byte}, out int)" />
726bool IFloatingPoint<double>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten)
749/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentLittleEndian(Span{byte}, out int)" />
750bool IFloatingPoint<double>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten)
773/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandBigEndian(Span{byte}, out int)" />
774bool IFloatingPoint<double>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten)
797/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandLittleEndian(Span{byte}, out int)" />
798bool IFloatingPoint<double>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Enum.cs (12)
1555private static bool TryFormatNumberAsHex<TStorage>(ref byte data, Span<char> destination, out int charsWritten) where TStorage : struct
1689bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider)
1749public static unsafe bool TryFormat<TEnum>(TEnum value, Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.EnumFormat)] ReadOnlySpan<char> format = default) where TEnum : struct
1805internal static unsafe bool TryFormatUnconstrained<TEnum>(TEnum value, Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.EnumFormat)] ReadOnlySpan<char> format = default)
1858private static bool TryFormatPrimitiveDefault<TUnderlying, TStorage>(RuntimeType enumType, TUnderlying value, Span<char> destination, out int charsWritten)
1893private static bool TryFormatPrimitiveNonDefault<TUnderlying, TStorage>(RuntimeType enumType, TUnderlying value, Span<char> destination, out int charsWritten, ReadOnlySpan<char> format)
1944Span<int> foundItems = stackalloc int[64];
1963private static bool TryFormatFlagNames<TStorage>(EnumInfo<TStorage> enumInfo, TStorage resultValue, Span<char> destination, out int charsWritten, ref bool isDestinationTooSmall)
1988Span<int> foundItems = stackalloc int[64];
2063private static bool TryFindFlagsNames<TStorage>(TStorage resultValue, string[] names, TStorage[] values, int index, Span<int> foundItems, out int resultLength, out int foundItemsCount)
2109private static void WriteMultipleFoundFlagsNames(string[] names, ReadOnlySpan<int> foundItems, Span<char> destination)
2118Span<char> afterSeparator = destination.Slice(2); // done before copying ", " to eliminate those two bounds checks
src\libraries\System.Private.CoreLib\src\System\Globalization\DateTimeFormat.cs (13)
777Span<TChar> chars = stackalloc TChar[11];
977Span<char> span = stackalloc char[FormatOMaxLength];
1029internal static bool TryFormat<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) where TChar : unmanaged, IUtfChar<TChar> =>
1032internal static bool TryFormat<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider, TimeSpan offset) where TChar : unmanaged, IUtfChar<TChar>
1316internal static unsafe bool TryFormatTimeOnlyO<TChar>(int hour, int minute, int second, long fraction, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1343internal static unsafe bool TryFormatTimeOnlyR<TChar>(int hour, int minute, int second, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1369internal static unsafe bool TryFormatDateOnlyO<TChar>(int year, int month, int day, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1395internal static unsafe bool TryFormatDateOnlyR<TChar>(DayOfWeek dayOfWeek, int year, int month, int day, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1439internal static unsafe bool TryFormatO<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1519internal static unsafe bool TryFormatS<TChar>(DateTime dateTime, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1554internal static unsafe bool TryFormatu<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1595internal static unsafe bool TryFormatR<TChar>(DateTime dateTime, TimeSpan offset, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1660internal static unsafe bool TryFormatInvariantG<TChar>(DateTime value, TimeSpan offset, Span<TChar> destination, out int bytesWritten) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\Globalization\TimeSpanFormat.cs (4)
51internal static bool TryFormat<TChar>(TimeSpan value, Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? formatProvider) where TChar : unmanaged, IUtfChar<TChar>
86Span<char> destination = stackalloc char[26]; // large enough for any "c" TimeSpan
95Span<char> destination = maxLength < 128 ?
109internal static unsafe bool TryFormatStandard<TChar>(TimeSpan value, StandardFormat format, ReadOnlySpan<TChar> decimalSeparator, Span<TChar> destination, out int written) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\Guid.cs (11)
440Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result));
526Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result));
880public bool TryWriteBytes(Span<byte> destination)
899public bool TryWriteBytes(Span<byte> destination, bool bigEndian, out int bytesWritten)
1177public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.GuidFormat)] ReadOnlySpan<char> format = default) =>
1180bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.GuidFormat)] ReadOnlySpan<char> format, IFormatProvider? provider) =>
1184public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.GuidFormat)] ReadOnlySpan<char> format = default) =>
1187bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.GuidFormat)] ReadOnlySpan<char> format, IFormatProvider? provider) =>
1200private bool TryFormatCore<TChar>(Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format) where TChar : unmanaged, IUtfChar<TChar>
1247internal unsafe bool TryFormatCore<TChar>(Span<TChar> destination, out int charsWritten, int flags) where TChar : unmanaged, IUtfChar<TChar>
1372private unsafe bool TryFormatX<TChar>(Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\Half.cs (10)
543public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
549public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
1367/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentBigEndian(Span{byte}, out int)" />
1368bool IFloatingPoint<Half>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten)
1385/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentLittleEndian(Span{byte}, out int)" />
1386bool IFloatingPoint<Half>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten)
1403/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandBigEndian(Span{byte}, out int)" />
1404bool IFloatingPoint<Half>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten)
1427/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandLittleEndian(Span{byte}, out int)" />
1428bool IFloatingPoint<Half>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Int16.cs (6)
118public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
124public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
465/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
466bool IBinaryInteger<short>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
483/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
484bool IBinaryInteger<short>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Int32.cs (6)
128public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
134public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
498/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
499bool IBinaryInteger<int>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
516/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
517bool IBinaryInteger<int>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Int64.cs (6)
125public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
131public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
495/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
496bool IBinaryInteger<long>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
513/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
514bool IBinaryInteger<long>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (6)
211public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
215public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
506/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
507bool IBinaryInteger<nint>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
529/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
530bool IBinaryInteger<nint>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (115)
27public static Span<T> AsSpan<T>(this T[]? array, int start)
47public static Span<T> AsSpan<T>(this T[]? array, Index startIndex)
71public static Span<T> AsSpan<T>(this T[]? array, Range range)
318public static unsafe bool Contains<T>(this Span<T> span, T value) where T : IEquatable<T>?
401public static bool ContainsAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>? =>
406public static bool ContainsAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>? =>
411public static bool ContainsAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>? =>
416public static bool ContainsAny<T>(this Span<T> span, SearchValues<T> values) where T : IEquatable<T>? =>
421public static bool ContainsAny(this Span<char> span, SearchValues<string> values) =>
426public static bool ContainsAnyExcept<T>(this Span<T> span, T value) where T : IEquatable<T>? =>
431public static bool ContainsAnyExcept<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>? =>
436public static bool ContainsAnyExcept<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>? =>
441public static bool ContainsAnyExcept<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>? =>
446public static bool ContainsAnyExcept<T>(this Span<T> span, SearchValues<T> values) where T : IEquatable<T>? =>
451public static bool ContainsAnyInRange<T>(this Span<T> span, T lowInclusive, T highInclusive) where T : IComparable<T> =>
456public static bool ContainsAnyExceptInRange<T>(this Span<T> span, T lowInclusive, T highInclusive) where T : IComparable<T> =>
619public static unsafe int IndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>?
657public static unsafe int IndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>?
685public static unsafe int LastIndexOf<T>(this Span<T> span, T value) where T : IEquatable<T>?
728public static unsafe int LastIndexOf<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>?
761public static int IndexOfAnyExcept<T>(this Span<T> span, T value) where T : IEquatable<T>? =>
773public static int IndexOfAnyExcept<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>? =>
786public static int IndexOfAnyExcept<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>? =>
797public static int IndexOfAnyExcept<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>? =>
809public static int IndexOfAnyExcept<T>(this Span<T> span, SearchValues<T> values) where T : IEquatable<T>? =>
1070public static int LastIndexOfAnyExcept<T>(this Span<T> span, T value) where T : IEquatable<T>? =>
1082public static int LastIndexOfAnyExcept<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>? =>
1095public static int LastIndexOfAnyExcept<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>? =>
1106public static int LastIndexOfAnyExcept<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>? =>
1118public static int LastIndexOfAnyExcept<T>(this Span<T> span, SearchValues<T> values) where T : IEquatable<T>? =>
1374public static int IndexOfAnyInRange<T>(this Span<T> span, T lowInclusive, T highInclusive)
1440public static int IndexOfAnyExceptInRange<T>(this Span<T> span, T lowInclusive, T highInclusive)
1506public static int LastIndexOfAnyInRange<T>(this Span<T> span, T lowInclusive, T highInclusive)
1572public static int LastIndexOfAnyExceptInRange<T>(this Span<T> span, T lowInclusive, T highInclusive)
1649public static unsafe bool SequenceEqual<T>(this Span<T> span, ReadOnlySpan<T> other) where T : IEquatable<T>?
1669public static int SequenceCompareTo<T>(this Span<T> span, ReadOnlySpan<T> other)
1839public static unsafe int IndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>?
1872public static unsafe int IndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>?
1905public static int IndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>? =>
1914public static int IndexOfAny<T>(this Span<T> span, SearchValues<T> values) where T : IEquatable<T>? =>
1923public static int IndexOfAny(this Span<char> span, SearchValues<string> values) =>
2145public static unsafe int LastIndexOfAny<T>(this Span<T> span, T value0, T value1) where T : IEquatable<T>?
2178public static unsafe int LastIndexOfAny<T>(this Span<T> span, T value0, T value1, T value2) where T : IEquatable<T>?
2211public static int LastIndexOfAny<T>(this Span<T> span, ReadOnlySpan<T> values) where T : IEquatable<T>? =>
2220public static int LastIndexOfAny<T>(this Span<T> span, SearchValues<T> values) where T : IEquatable<T>? =>
2448public static bool SequenceEqual<T>(this Span<T> span, ReadOnlySpan<T> other, IEqualityComparer<T>? comparer = null) =>
2537public static unsafe bool StartsWith<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>?
2577public static unsafe bool EndsWith<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>?
2625public static void Reverse<T>(this Span<T> span)
2637public static Span<T> AsSpan<T>(this T[]? array)
2655public static Span<T> AsSpan<T>(this T[]? array, int start, int length)
2664public static Span<T> AsSpan<T>(this ArraySegment<T> segment)
2681public static Span<T> AsSpan<T>(this ArraySegment<T> segment, int start)
2696public static Span<T> AsSpan<T>(this ArraySegment<T> segment, Index startIndex)
2715public static Span<T> AsSpan<T>(this ArraySegment<T> segment, int start, int length)
2731public static Span<T> AsSpan<T>(this ArraySegment<T> segment, Range range)
2864public static void CopyTo<T>(this T[]? source, Span<T> destination)
3017public static bool Overlaps<T>(this Span<T> span, ReadOnlySpan<T> other)
3026public static bool Overlaps<T>(this Span<T> span, ReadOnlySpan<T> other, out int elementOffset)
3081/// Searches an entire sorted <see cref="Span{T}"/> for a value
3085/// <param name="span">The sorted <see cref="Span{T}"/> to search.</param>
3091/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>.
3098this Span<T> span, IComparable<T> comparable)
3104/// Searches an entire sorted <see cref="Span{T}"/> for a value
3109/// <param name="span">The sorted <see cref="Span{T}"/> to search.</param>
3115/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>.
3122this Span<T> span, TComparable comparable)
3129/// Searches an entire sorted <see cref="Span{T}"/> for the specified <paramref name="value"/>
3134/// <param name="span">The sorted <see cref="Span{T}"/> to search.</param>
3141/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>.
3148this Span<T> span, T value, TComparer comparer)
3234/// Sorts the elements in the entire <see cref="Span{T}" /> using the <see cref="IComparable{T}" /> implementation
3235/// of each element of the <see cref= "Span{T}" />
3238/// <param name="span">The <see cref="Span{T}"/> to sort.</param>
3242public static void Sort<T>(this Span<T> span) =>
3246/// Sorts the elements in the entire <see cref="Span{T}" /> using the <typeparamref name="TComparer" />.
3250/// <param name="span">The <see cref="Span{T}"/> to sort.</param>
3262public static void Sort<T, TComparer>(this Span<T> span, TComparer comparer)
3272/// Sorts the elements in the entire <see cref="Span{T}" /> using the specified <see cref="Comparison{T}" />.
3275/// <param name="span">The <see cref="Span{T}"/> to sort.</param>
3278public static void Sort<T>(this Span<T> span, Comparison<T> comparison)
3291/// based on the keys in the first <see cref="Span{TKey}" /> using the <see cref="IComparable{T}" />
3304public static void Sort<TKey, TValue>(this Span<TKey> keys, Span<TValue> items) =>
3309/// based on the keys in the first <see cref="Span{TKey}" /> using the specified comparer.
3327public static void Sort<TKey, TValue, TComparer>(this Span<TKey> keys, Span<TValue> items, TComparer comparer)
3341/// based on the keys in the first <see cref="Span{TKey}" /> using the specified comparison.
3352public static void Sort<TKey, TValue>(this Span<TKey> keys, Span<TValue> items, Comparison<TKey> comparison)
3373public static unsafe void Replace<T>(this Span<T> span, T oldValue, T newValue) where T : IEquatable<T>?
3441public static unsafe void Replace<T>(this ReadOnlySpan<T> source, Span<T> destination, T oldValue, T newValue) where T : IEquatable<T>?
3518public static int CommonPrefixLength<T>(this Span<T> span, ReadOnlySpan<T> other) =>
3527public static int CommonPrefixLength<T>(this Span<T> span, ReadOnlySpan<T> other, IEqualityComparer<T>? comparer) =>
3651public static int Split(this ReadOnlySpan<char> source, Span<Range> destination, char separator, StringSplitOptions options = StringSplitOptions.None)
3685public static int Split(this ReadOnlySpan<char> source, Span<Range> destination, ReadOnlySpan<char> separator, StringSplitOptions options = StringSplitOptions.None)
3741public static int SplitAny(this ReadOnlySpan<char> source, Span<Range> destination, ReadOnlySpan<char> separators, StringSplitOptions options = StringSplitOptions.None)
3782public static int SplitAny(this ReadOnlySpan<char> source, Span<Range> destination, ReadOnlySpan<string> separators, StringSplitOptions options = StringSplitOptions.None)
3806ReadOnlySpan<char> source, Span<Range> destination,
3879Span<Range> destinationMinusOne = destination.Slice(0, destination.Length - 1);
3962public static int Count<T>(this Span<T> span, T value) where T : IEquatable<T>? =>
4016public static int Count<T>(this Span<T> span, ReadOnlySpan<T> value) where T : IEquatable<T>? =>
4053public static bool TryWrite(this Span<char> destination, [InterpolatedStringHandlerArgument(nameof(destination))] ref TryWriteInterpolatedStringHandler handler, out int charsWritten)
4073public static bool TryWrite(this Span<char> destination, IFormatProvider? provider, [InterpolatedStringHandlerArgument(nameof(destination), nameof(provider))] ref TryWriteInterpolatedStringHandler handler, out int charsWritten) =>
4091public static bool TryWrite<TArg0>(this Span<char> destination, IFormatProvider? provider, CompositeFormat format, out int charsWritten, TArg0 arg0)
4113public static bool TryWrite<TArg0, TArg1>(this Span<char> destination, IFormatProvider? provider, CompositeFormat format, out int charsWritten, TArg0 arg0, TArg1 arg1)
4137public static bool TryWrite<TArg0, TArg1, TArg2>(this Span<char> destination, IFormatProvider? provider, CompositeFormat format, out int charsWritten, TArg0 arg0, TArg1 arg1, TArg2 arg2)
4157public static bool TryWrite(this Span<char> destination, IFormatProvider? provider, CompositeFormat format, out int charsWritten, params object?[] args)
4176public static bool TryWrite(this Span<char> destination, IFormatProvider? provider, CompositeFormat format, out int charsWritten, /*params*/ ReadOnlySpan<object?> args)
4189private static bool TryWrite<TArg0, TArg1, TArg2>(Span<char> destination, IFormatProvider? provider, CompositeFormat format, out int charsWritten, TArg0 arg0, TArg1 arg1, TArg2 arg2, ReadOnlySpan<object?> args)
4250private readonly Span<char> _destination;
4267/// <summary>Creates a handler used to write an interpolated string into a <see cref="Span{Char}"/>.</summary>
4273public TryWriteInterpolatedStringHandler(int literalLength, int formattedCount, Span<char> destination, out bool shouldAppend)
4282/// <summary>Creates a handler used to write an interpolated string into a <see cref="Span{Char}"/>.</summary>
4289public TryWriteInterpolatedStringHandler(int literalLength, int formattedCount, Span<char> destination, IFormatProvider? provider, out bool shouldAppend)
src\libraries\System.Private.CoreLib\src\System\Number.Formatting.cs (31)
341public static unsafe bool TryFormatDecimal<TChar>(decimal value, ReadOnlySpan<char> format, NumberFormatInfo info, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
405public static bool TryFormatDouble<TChar>(double value, ReadOnlySpan<char> format, NumberFormatInfo info, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
635public static bool TryFormatSingle<TChar>(float value, ReadOnlySpan<char> format, NumberFormatInfo info, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
833public static bool TryFormatHalf<TChar>(Half value, ReadOnlySpan<char> format, NumberFormatInfo info, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
849private static bool TryCopyTo<TChar>(string source, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
938public static bool TryFormatInt32<TChar>(int value, int hexMask, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
950static unsafe bool TryFormatInt32Slow(int value, int hexMask, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1052public static bool TryFormatUInt32<TChar>(uint value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1064static unsafe bool TryFormatUInt32Slow(uint value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1168public static bool TryFormatInt64<TChar>(long value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1182static unsafe bool TryFormatInt64Slow(long value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1284public static bool TryFormatUInt64<TChar>(ulong value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1296static unsafe bool TryFormatUInt64Slow(ulong value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1401public static bool TryFormatInt128<TChar>(Int128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1415static unsafe bool TryFormatInt128Slow(Int128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1519public static bool TryFormatUInt128<TChar>(UInt128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1531static unsafe bool TryFormatUInt128Slow(UInt128 value, ReadOnlySpan<char> format, IFormatProvider? provider, Span<TChar> destination, out int charsWritten)
1639internal static unsafe bool TryNegativeInt32ToDecStr<TChar>(int value, int digits, ReadOnlySpan<TChar> sNegative, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1688internal static unsafe bool TryInt32ToHexStr<TChar>(int value, char hexBase, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1744private static unsafe bool TryUInt32ToBinaryStr<TChar>(uint value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1963internal static unsafe bool TryUInt32ToDecStr<TChar>(uint value, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
1983internal static unsafe bool TryUInt32ToDecStr<TChar>(uint value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2072internal static unsafe bool TryNegativeInt64ToDecStr<TChar>(long value, int digits, ReadOnlySpan<TChar> sNegative, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2121internal static unsafe bool TryInt64ToHexStr<TChar>(long value, char hexBase, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2193private static unsafe bool TryUInt64ToBinaryStr<TChar>(ulong value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2391internal static unsafe bool TryUInt64ToDecStr<TChar>(ulong value, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2412internal static unsafe bool TryUInt64ToDecStr<TChar>(ulong value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2500private static unsafe bool TryNegativeInt128ToDecStr<TChar>(Int128 value, int digits, ReadOnlySpan<TChar> sNegative, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2553private static unsafe bool TryInt128ToHexStr<TChar>(Int128 value, char hexBase, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2616private static unsafe bool TryUInt128ToBinaryStr<TChar>(Int128 value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
2753private static unsafe bool TryUInt128ToDecStr<TChar>(UInt128 value, int digits, Span<TChar> destination, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\Number.Grisu3.cs (6)
429private static bool TryRunCounted(in DiyFp w, int requestedDigits, Span<byte> buffer, out int length, out int decimalExponent)
477private static bool TryRunShortest(in DiyFp boundaryMinus, in DiyFp w, in DiyFp boundaryPlus, Span<byte> buffer, out int length, out int decimalExponent)
580private static bool TryDigitGenCounted(in DiyFp w, int requestedDigits, Span<byte> buffer, out int length, out int kappa)
749private static bool TryDigitGenShortest(in DiyFp low, in DiyFp w, in DiyFp high, Span<byte> buffer, out int length, out int kappa)
914private static bool TryRoundWeedCounted(Span<byte> buffer, int length, ulong rest, ulong tenKappa, ulong unit, ref int kappa)
987private static bool TryRoundWeedShortest(Span<byte> buffer, int length, ulong distanceTooHighW, ulong unsafeInterval, ulong rest, ulong tenKappa, ulong unit)
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBaseInvoker.cs (15)
78Span<object?> copyOfArgs = new(ref copyOfArg);
81Span<bool> shouldCopyBack = new(ref copyBack);
121Span<object?> copyOfArgs = ((Span<object?>)stackArgStorage._args).Slice(0, _argCount);
122Span<bool> shouldCopyBack = ((Span<bool>)stackArgStorage._shouldCopyBack).Slice(0, _argCount);
153internal unsafe object? InvokeDirectByRefWithFewArgs(object? obj, Span<object?> copyOfArgs, BindingFlags invokeAttr)
195Span<object?> copyOfArgs;
198Span<bool> shouldCopyBack;
298Span<object?> copyOfArgs = new(ref copyOfArg, 1);
301Span<bool> shouldCopyBack = new(ref copyBack, 1); // Not used for setters
330internal void CopyBack(object?[] dest, Span<object?> copyOfParameters, Span<bool> shouldCopyBack)
353Span<object?> copyOfParameters,
354Span<bool> shouldCopyBack,
src\libraries\System.Private.CoreLib\src\System\Reflection\MethodInvoker.cs (12)
239public object? Invoke(object? obj, Span<object?> arguments)
296internal object? InvokeWithFewArgs(object? obj, Span<object?> arguments)
301Span<object?> copyOfArgs = ((Span<object?>)stackArgStorage._args).Slice(0, _argCount);
302scoped Span<bool> shouldCopyBack = ((Span<bool>)stackArgStorage._shouldCopyBack).Slice(0, _argCount);
335return InvokeDirectByRefWithFewArgs(obj, ((Span<object?>)stackStorage._args).Slice(0, _argCount));
338internal unsafe object? InvokeDirectByRefWithFewArgs(object? obj, Span<object?> copyOfArgs)
362internal unsafe object? InvokeWithManyArgs(object? obj, Span<object?> arguments)
364Span<object?> copyOfArgs;
448internal void CopyBack(Span<object?> dest, Span<object?> copyOfParameters, Span<bool> shouldCopyBack)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\Marshalling\SpanMarshaller.cs (17)
12/// Supports marshalling a <see cref="Span{T}"/> from managed value
18/// A <see cref="Span{T}"/> marshalled with this marshaller will match the semantics of <see cref="MemoryMarshal.GetReference{T}(Span{T})"/>.
22[CustomMarshaller(typeof(Span<>), MarshalMode.Default, typeof(SpanMarshaller<,>))]
23[CustomMarshaller(typeof(Span<>), MarshalMode.ManagedToUnmanagedIn, typeof(SpanMarshaller<,>.ManagedToUnmanagedIn))]
34public static TUnmanagedElement* AllocateContainerForUnmanagedElements(Span<T> managed, out int numElements)
56public static ReadOnlySpan<T> GetManagedValuesSource(Span<T> managed)
65public static Span<TUnmanagedElement> GetUnmanagedValuesDestination(TUnmanagedElement* unmanaged, int numElements)
74public static Span<T> AllocateContainerForManagedElements(TUnmanagedElement* unmanaged, int numElements)
87public static Span<T> GetManagedValuesDestination(Span<T> managed)
114private Span<T> _managedArray;
116private Span<TUnmanagedElement> _span;
127public void FromManaged(Span<T> managed, Span<TUnmanagedElement> buffer)
163public Span<TUnmanagedElement> GetUnmanagedValuesDestination() => _span;
192public static ref T GetPinnableReference(Span<T> managed)
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (10)
872public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) => _value.TryFormat(destination, out charsWritten, format, provider);
875public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) => _value.TryFormat(utf8Destination, out bytesWritten, format, provider);
1052/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentBigEndian(Span{byte}, out int)" />
1053bool IFloatingPoint<NFloat>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten)
1076/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentLittleEndian(Span{byte}, out int)" />
1077bool IFloatingPoint<NFloat>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten)
1100/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandBigEndian(Span{byte}, out int)" />
1101bool IFloatingPoint<NFloat>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten)
1124/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandLittleEndian(Span{byte}, out int)" />
1125bool IFloatingPoint<NFloat>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\SByte.cs (6)
121public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
127public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
426/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
427bool IBinaryInteger<sbyte>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
444/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
445bool IBinaryInteger<sbyte>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Single.cs (10)
370public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
376public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
720/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentBigEndian(Span{byte}, out int)" />
721bool IFloatingPoint<float>.TryWriteExponentBigEndian(Span<byte> destination, out int bytesWritten)
738/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteExponentLittleEndian(Span{byte}, out int)" />
739bool IFloatingPoint<float>.TryWriteExponentLittleEndian(Span<byte> destination, out int bytesWritten)
756/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandBigEndian(Span{byte}, out int)" />
757bool IFloatingPoint<float>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten)
780/// <inheritdoc cref="IFloatingPoint{TSelf}.TryWriteSignificandLittleEndian(Span{byte}, out int)" />
781bool IFloatingPoint<float>.TryWriteSignificandLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.CaseConversion.cs (18)
25/// <remarks>In-place conversion is prohibited, please use <see cref="ToUpperInPlace(Span{byte}, out int)"/> for that.</remarks>
27public static OperationStatus ToUpper(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)
38/// <remarks>In-place conversion is prohibited, please use <see cref="ToUpperInPlace(Span{char}, out int)"/> for that.</remarks>
40public static OperationStatus ToUpper(ReadOnlySpan<char> source, Span<char> destination, out int charsWritten)
52public static OperationStatus ToUpper(ReadOnlySpan<byte> source, Span<char> destination, out int charsWritten)
64public static OperationStatus ToUpper(ReadOnlySpan<char> source, Span<byte> destination, out int bytesWritten)
75/// <remarks>In-place conversion is prohibited, please use <see cref="ToLowerInPlace(Span{byte}, out int)"/> for that.</remarks>
77public static OperationStatus ToLower(ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)
88/// <remarks>In-place conversion is prohibited, please use <see cref="ToLowerInPlace(Span{char}, out int)"/> for that.</remarks>
90public static OperationStatus ToLower(ReadOnlySpan<char> source, Span<char> destination, out int charsWritten)
102public static OperationStatus ToLower(ReadOnlySpan<byte> source, Span<char> destination, out int charsWritten)
114public static OperationStatus ToLower(ReadOnlySpan<char> source, Span<byte> destination, out int bytesWritten)
124public static OperationStatus ToLowerInPlace(Span<byte> value, out int bytesWritten)
134public static OperationStatus ToLowerInPlace(Span<char> value, out int charsWritten)
144public static OperationStatus ToUpperInPlace(Span<byte> value, out int bytesWritten)
154public static OperationStatus ToUpperInPlace(Span<char> value, out int charsWritten)
157private static unsafe OperationStatus ChangeCase<TFrom, TTo, TCasing>(ReadOnlySpan<TFrom> source, Span<TTo> destination, out int destinationElementsWritten)
192private static unsafe OperationStatus ChangeCase<T, TCasing>(Span<T> buffer, out int elementsWritten)
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (7)
314public override unsafe int GetBytes(ReadOnlySpan<char> chars, Span<byte> bytes)
326public override unsafe bool TryGetBytes(ReadOnlySpan<char> chars, Span<byte> bytes, out int bytesWritten)
381private protected sealed override unsafe int GetBytesWithFallback(ReadOnlySpan<char> chars, int originalCharsLength, Span<byte> bytes, int originalBytesLength, EncoderNLS? encoder, bool throwForDestinationOverflow = true)
605public override unsafe int GetChars(ReadOnlySpan<byte> bytes, Span<char> chars)
617public override unsafe bool TryGetChars(ReadOnlySpan<byte> bytes, Span<char> chars, out int charsWritten)
670private protected sealed override unsafe int GetCharsWithFallback(ReadOnlySpan<byte> bytes, int originalBytesLength, Span<char> chars, int originalCharsLength, DecoderNLS? decoder, bool throwForDestinationOverflow = true)
778internal sealed override OperationStatus EncodeRune(Rune value, Span<byte> bytes, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (6)
79internal virtual OperationStatus EncodeRune(Rune value, Span<byte> bytes, out int bytesWritten)
512/// after data has been drained, then to call <see cref="GetBytesWithFallback(ReadOnlySpan{char}, int, Span{byte}, int, EncoderNLS, bool)"/>.
532Span<byte> bytes = new Span<byte>(pOriginalBytes, originalByteCount).Slice(bytesWrittenSoFar);
586private protected virtual unsafe int GetBytesWithFallback(ReadOnlySpan<char> chars, int originalCharsLength, Span<byte> bytes, int originalBytesLength, EncoderNLS? encoder, bool throwForDestinationOverflow = true)
1134Span<char> chars = new Span<char>(pOriginalChars, originalCharCount).Slice(charsWrittenSoFar);
1187private protected virtual unsafe int GetCharsWithFallback(ReadOnlySpan<byte> bytes, int originalBytesLength, Span<char> chars, int originalCharsLength, DecoderNLS? decoder, bool throwForDestinationOverflow = true)
src\libraries\System.Private.CoreLib\src\System\Text\Rune.cs (10)
213Span<char> original = stackalloc char[MaxUtf16CharsPerRune];
214Span<char> modified = stackalloc char[MaxUtf16CharsPerRune];
735public int EncodeToUtf16(Span<char> destination)
753public int EncodeToUtf8(Span<byte> destination)
916bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
919bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
1009public bool TryEncodeToUtf16(Span<char> destination, out int charsWritten)
1016private static bool TryEncodeToUtf16(Rune value, Span<char> destination, out int charsWritten)
1053public bool TryEncodeToUtf8(Span<byte> destination, out int bytesWritten)
1060private static bool TryEncodeToUtf8(Rune value, Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (13)
47public static unsafe OperationStatus FromUtf16(ReadOnlySpan<char> source, Span<byte> destination, out int charsRead, out int bytesWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true)
133public static unsafe OperationStatus ToUtf16(ReadOnlySpan<byte> source, Span<char> destination, out int bytesRead, out int charsWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true)
219internal static unsafe OperationStatus ToUtf16PreservingReplacement(ReadOnlySpan<byte> source, Span<char> destination, out int bytesRead, out int charsWritten, bool replaceInvalidSequences = true, bool isFinalBlock = true)
323public static bool TryWrite(Span<byte> destination, [InterpolatedStringHandlerArgument(nameof(destination))] ref TryWriteInterpolatedStringHandler handler, out int bytesWritten)
343public static bool TryWrite(Span<byte> destination, IFormatProvider? provider, [InterpolatedStringHandlerArgument(nameof(destination), nameof(provider))] ref TryWriteInterpolatedStringHandler handler, out int bytesWritten) =>
354private readonly Span<byte> _destination;
364/// <summary>Creates a handler used to write an interpolated string into a UTF-8 <see cref="Span{Byte}"/>.</summary>
370public TryWriteInterpolatedStringHandler(int literalLength, int formattedCount, Span<byte> destination, out bool shouldAppend)
379/// <summary>Creates a handler used to write an interpolated string into a UTF-8 <see cref="Span{Byte}"/>.</summary>
386public TryWriteInterpolatedStringHandler(int literalLength, int formattedCount, Span<byte> destination, IFormatProvider? provider, out bool shouldAppend)
403Span<byte> dest = _destination.Slice(_pos);
677Span<char> utf16 = stackalloc char[256];
724Span<char> utf16 = stackalloc char[256];
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (6)
361public override unsafe int GetBytes(ReadOnlySpan<char> chars, Span<byte> bytes)
373public override unsafe bool TryGetBytes(ReadOnlySpan<char> chars, Span<byte> bytes, out int bytesWritten)
556public override unsafe int GetChars(ReadOnlySpan<byte> bytes, Span<char> chars)
568public override unsafe bool TryGetChars(ReadOnlySpan<byte> bytes, Span<char> chars, out int charsWritten)
634private protected sealed override unsafe int GetCharsWithFallback(ReadOnlySpan<byte> bytes, int originalBytesLength, Span<char> chars, int originalCharsLength, DecoderNLS? decoder, bool throwForDestinationOverflow = true)
777internal sealed override OperationStatus EncodeRune(Rune value, Span<byte> bytes, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\TimeOnly.cs (3)
961public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
965public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
968private bool TryFormatCore<TChar>(Span<TChar> destination, out int written, [StringSyntax(StringSyntaxAttribute.TimeOnlyFormat)] ReadOnlySpan<char> format, IFormatProvider? provider) where TChar : unmanaged, IUtfChar<TChar>
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (6)
113public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
119public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
397/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
398bool IBinaryInteger<ushort>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
415/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
416bool IBinaryInteger<ushort>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (6)
123public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
129public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
429/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
430bool IBinaryInteger<uint>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
447/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
448bool IBinaryInteger<uint>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (6)
122public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
128public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
428/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
429bool IBinaryInteger<ulong>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
446/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
447bool IBinaryInteger<ulong>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (6)
207public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
211public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
438/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
439bool IBinaryInteger<nuint>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
461/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
462bool IBinaryInteger<nuint>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
src\libraries\System.Private.CoreLib\src\System\Version.cs (8)
173Span<char> dest = stackalloc char[(4 * Number.Int32NumberBufferLength) + 3]; // at most 4 Int32s and 3 periods
182public bool TryFormat(Span<char> destination, out int charsWritten) =>
185public bool TryFormat(Span<char> destination, int fieldCount, out int charsWritten) =>
192public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten) =>
200public bool TryFormat(Span<byte> utf8Destination, int fieldCount, out int bytesWritten) =>
203private bool TryFormatCore<TChar>(Span<TChar> destination, int fieldCount, out int charsWritten) where TChar : unmanaged, IUtfChar<TChar>
269bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
274bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider) =>
System.Private.CoreLib.Generators (8)
System.Private.DataContractSerialization (24)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System\Xml\XmlBinaryWriter.cs (10)
736Span<byte> span = GetTextNodeBuffer(1 + sizeof(float), out int offset).AsSpan(offset, 1 + sizeof(float));
761Span<byte> span = GetTextNodeBuffer(1 + sizeof(double), out int offset).AsSpan(offset, 1 + sizeof(double));
777Span<int> bits = stackalloc int[4];
781Span<byte> span = GetTextNodeBuffer(1 + sizeof(decimal), out int offset).AsSpan(offset, 1 + sizeof(decimal));
813Span<byte> span = GetTextNodeBuffer(17, out int offset).AsSpan(offset, 17);
924Span<byte> span = GetBuffer(sizeof(float), out int bufferOffset).AsSpan(bufferOffset, sizeof(float));
942Span<byte> span = GetBuffer(sizeof(double), out int bufferOffset).AsSpan(bufferOffset, sizeof(double));
957Span<int> bits = stackalloc int[4];
964Span<byte> span = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16);
995Span<byte> bytes = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16);
System.Private.Uri (30)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Private.Xml (59)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System\Xml\XmlConvert.cs (20)
1639internal static bool TryFormat(bool value, Span<char> destination, out int charsWritten)
1647internal static bool TryFormat(char value, Span<char> destination, out int charsWritten)
1656internal static bool TryFormat(decimal value, Span<char> destination, out int charsWritten)
1661internal static bool TryFormat(sbyte value, Span<char> destination, out int charsWritten)
1666internal static bool TryFormat(short value, Span<char> destination, out int charsWritten)
1671internal static bool TryFormat(int value, Span<char> destination, out int charsWritten)
1676internal static bool TryFormat(long value, Span<char> destination, out int charsWritten)
1681internal static bool TryFormat(byte value, Span<char> destination, out int charsWritten)
1686internal static bool TryFormat(ushort value, Span<char> destination, out int charsWritten)
1691internal static bool TryFormat(uint value, Span<char> destination, out int charsWritten)
1696internal static bool TryFormat(ulong value, Span<char> destination, out int charsWritten)
1701internal static bool TryFormat(float value, Span<char> destination, out int charsWritten)
1725internal static bool TryFormat(double value, Span<char> destination, out int charsWritten)
1749internal static bool TryFormat(TimeSpan value, Span<char> destination, out int charsWritten)
1754internal static bool TryFormat(DateTime value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, Span<char> destination, out int charsWritten)
1759internal static bool TryFormat(DateTime value, Span<char> destination, out int charsWritten)
1764internal static bool TryFormat(DateTime value, XmlDateTimeSerializationMode dateTimeOption, Span<char> destination, out int charsWritten)
1791internal static bool TryFormat(DateTimeOffset value, Span<char> destination, out int charsWritten)
1797internal static bool TryFormat(DateTimeOffset value, [StringSyntax(StringSyntaxAttribute.DateTimeFormat)] string format, Span<char> destination, out int charsWritten)
1802internal static bool TryFormat(Guid value, Span<char> destination, out int charsWritten)
System.Reflection.Metadata (21)
System.Resources.Extensions (1)
System.Runtime (1)
System.Runtime.InteropServices.JavaScript (7)
System.Runtime.Numerics (232)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System\Number.BigInteger.cs (27)
244Span<uint> wholeBlockDestination = bits.AsSpan(0, wholeBlockCount);
348Span<uint> stackBuffer = stackalloc uint[BigIntegerCalculator.StackAllocThreshold];
349Span<uint> currentBuffer = stackBuffer;
367bool ProcessChunk(ReadOnlySpan<byte> chunkDigits, ref Span<uint> currentBuffer)
429Span<uint> currentBuffer;
436Span<uint> buffer = new uint[bufferSize];
438Span<uint> newBuffer = MemoryMarshal.Cast<int, uint>(arrayFromPoolForResultBuffer).Slice(0, bufferSize);
490Span<uint> multiplier = MemoryMarshal.Cast<int, uint>(arrayFromPoolForMultiplier).Slice(0, blockSize);
503Span<uint> curBuffer = buffer.Slice(i);
504Span<uint> curNewBuffer = newBuffer.Slice(i);
539Span<uint> tmp = buffer;
552Span<uint> newMultiplier = MemoryMarshal.Cast<int, uint>(arrayFromPoolForMultiplier).Slice(0, blockSize);
586BigInteger NumberBufferToBigInteger(Span<uint> currentBuffer, bool signa)
624void MultiplyAdd(ref Span<uint> currentBuffer, uint multiplier, uint addValue)
626Span<uint> curBits = currentBuffer.Slice(0, currentBufferSize);
646Span<uint> newBuffer = MemoryMarshal.Cast<int, uint>(arrayFromPoolForResultBuffer);
661private static string? FormatBigIntegerToHex(bool targetSpan, BigInteger value, char format, int digits, NumberFormatInfo info, Span<char> destination, out int charsWritten, out bool spanSuccess)
667Span<byte> bits = stackalloc byte[64]; // arbitrary threshold
706Span<char> chars = sb.AppendSpan((cur + 1) * 2);
744private static string? FormatBigIntegerToBinary(bool targetSpan, BigInteger value, int digits, Span<char> destination, out int charsWritten, out bool spanSuccess)
748Span<byte> bytes = stackalloc byte[64]; // arbitrary threshold
848internal static bool TryFormatBigInteger(BigInteger value, ReadOnlySpan<char> format, NumberFormatInfo info, Span<char> destination, out int charsWritten)
860NumberFormatInfo info, Span<char> destination, out int charsWritten, out bool spanSuccess)
904Span<uint> base1E9Buffer = cuMax < BigIntegerCalculator.StackAllocThreshold ?
982Span<byte> numberBuffer = valueDigits + 1 <= CharStackBufferSize ?
1076static virtual bool TryParseWholeBlocks(ReadOnlySpan<TChar> input, Span<uint> destination)
1106public static bool TryParseWholeBlocks(ReadOnlySpan<TChar> input, Span<uint> destination)
System\Numerics\BigInteger.cs (59)
218Span<int> bits = stackalloc int[4];
366Span<byte> uintBytes = MemoryMarshal.AsBytes(val.AsSpan(0, wholeUInt32Count));
528private BigInteger(Span<uint> value)
767Span<uint> quotient = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
797Span<uint> rest = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
803Span<uint> quotient = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
920Span<uint> bits = (leftBits.Length <= BigIntegerCalculator.StackAllocThreshold
933Span<uint> bits = (leftBits.Length <= BigIntegerCalculator.StackAllocThreshold
988Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1048Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1059Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1264public bool TryWriteBytes(Span<byte> destination, out int bytesWritten, bool isUnsigned = false, bool isBigEndian = false)
1275internal bool TryWriteOrCountBytes(Span<byte> destination, out int bytesWritten, bool isUnsigned = false, bool isBigEndian = false)
1281/// <summary>Gets the number of bytes that will be output by <see cref="ToByteArray(bool, bool)"/> and <see cref="TryWriteBytes(Span{byte}, out int, bool, bool)"/>.</summary>
1288TryGetBytes(GetBytesMode.Count, default(Span<byte>), isUnsigned, IsBigEndian, ref count);
1292/// <summary>Mode used to enable sharing <see cref="TryGetBytes(GetBytesMode, Span{byte}, bool, bool, ref int)"/> for multiple purposes.</summary>
1300/// <summary>Shared logic for <see cref="ToByteArray(bool, bool)"/>, <see cref="TryWriteBytes(Span{byte}, out int, bool, bool)"/>, and <see cref="GetByteCount"/>.</summary>
1316private byte[]? TryGetBytes(GetBytesMode mode, Span<byte> destination, bool isUnsigned, bool isBigEndian, ref int bytesWritten)
1505private int WriteTo(Span<uint> buffer)
1629public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
1649Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1661Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1673Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1685Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
1727Span<uint> bits = (size <= BigIntegerCalculator.StackAllocThreshold
1739Span<uint> bits = (size <= BigIntegerCalculator.StackAllocThreshold
1749Span<uint> bits = (size <= BigIntegerCalculator.StackAllocThreshold
1761Span<uint> bits = (size <= BigIntegerCalculator.StackAllocThreshold
2338Span<uint> x = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2345Span<uint> y = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2352Span<uint> z = (size <= BigIntegerCalculator.StackAllocThreshold
2394Span<uint> x = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2401Span<uint> y = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2408Span<uint> z = (size <= BigIntegerCalculator.StackAllocThreshold
2445Span<uint> x = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2452Span<uint> y = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2459Span<uint> z = (size <= BigIntegerCalculator.StackAllocThreshold
2499Span<uint> xd = (xl <= BigIntegerCalculator.StackAllocThreshold
2506Span<uint> zd = ((uint)zl <= BigIntegerCalculator.StackAllocThreshold
2560Span<uint> xd = (xl <= BigIntegerCalculator.StackAllocThreshold
2588Span<uint> zd = ((uint)zl <= BigIntegerCalculator.StackAllocThreshold
2702Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2714Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2724Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2736Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2749Span<uint> bits = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2791Span<uint> quotient = ((uint)size <= BigIntegerCalculator.StackAllocThreshold
2817Span<uint> quotient = ((uint)size < BigIntegerCalculator.StackAllocThreshold
2867Span<uint> bits = (size <= BigIntegerCalculator.StackAllocThreshold
3101private bool GetPartsForBitManipulation(Span<uint> xd)
3251Span<uint> xd = (xl <= BigIntegerCalculator.StackAllocThreshold)
3261Span<uint> zd = (zl <= BigIntegerCalculator.StackAllocThreshold)
3386Span<uint> xd = (xl <= BigIntegerCalculator.StackAllocThreshold)
3396Span<uint> zd = (zl <= BigIntegerCalculator.StackAllocThreshold)
3591/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteBigEndian(Span{byte}, out int)" />
3592bool IBinaryInteger<BigInteger>.TryWriteBigEndian(Span<byte> destination, out int bytesWritten)
3693/// <inheritdoc cref="IBinaryInteger{TSelf}.TryWriteLittleEndian(Span{byte}, out int)" />
3694bool IBinaryInteger<BigInteger>.TryWriteLittleEndian(Span<byte> destination, out int bytesWritten)
5231Span<uint> xd = (xl <= BigIntegerCalculator.StackAllocThreshold
System\Numerics\BigIntegerCalculator.AddSub.cs (9)
14private static void CopyTail(ReadOnlySpan<uint> source, Span<uint> dest, int start)
19public static void Add(ReadOnlySpan<uint> left, uint right, Span<uint> bits)
27public static void Add(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> bits)
59private static void AddSelf(Span<uint> left, ReadOnlySpan<uint> right)
90public static void Subtract(ReadOnlySpan<uint> left, uint right, Span<uint> bits)
99public static void Subtract(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> bits)
132private static void SubtractSelf(Span<uint> left, ReadOnlySpan<uint> right)
167private static void Add(ReadOnlySpan<uint> left, Span<uint> bits, ref uint resultPtr, int startIndex, long initialCarry)
214private static void Subtract(ReadOnlySpan<uint> left, Span<uint> bits, ref uint resultPtr, int startIndex, long initialCarry)
System\Numerics\BigIntegerCalculator.DivRem.cs (11)
11public static void Divide(ReadOnlySpan<uint> left, uint right, Span<uint> quotient, out uint remainder)
32public static void Divide(ReadOnlySpan<uint> left, uint right, Span<uint> quotient)
64public static void Divide(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> quotient, Span<uint> remainder)
76public static void Divide(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> quotient)
89Span<uint> leftCopy = (left.Length <= StackAllocThreshold ?
100public static void Remainder(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> remainder)
113private static void Divide(Span<uint> left, ReadOnlySpan<uint> right, Span<uint> bits)
196private static uint AddDivisor(Span<uint> left, ReadOnlySpan<uint> right)
215private static uint SubtractDivisor(Span<uint> left, ReadOnlySpan<uint> right, ulong q)
System\Numerics\BigIntegerCalculator.FastReducer.cs (9)
20private readonly Span<uint> _q1;
21private readonly Span<uint> _q2;
23public FastReducer(ReadOnlySpan<uint> modulus, Span<uint> r, Span<uint> mu, Span<uint> q1, Span<uint> q2)
44public int Reduce(Span<uint> value)
68private static int DivMul(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> bits, int k)
102private static int SubMod(Span<uint> left, ReadOnlySpan<uint> right, ReadOnlySpan<uint> modulus, int k)
System\Numerics\BigIntegerCalculator.PowMod.cs (57)
16public static void Pow(uint value, uint power, Span<uint> bits)
21public static void Pow(ReadOnlySpan<uint> value, uint power, Span<uint> bits)
26Span<uint> temp = (bits.Length <= StackAllocThreshold ?
32Span<uint> valueCopy = (bits.Length <= StackAllocThreshold ?
38Span<uint> result = PowCore(valueCopy, value.Length, temp, power, bits);
48private static Span<uint> PowCore(Span<uint> value, int valueLength, Span<uint> temp, uint power, Span<uint> result)
70private static int MultiplySelf(ref Span<uint> left, int leftLength, ReadOnlySpan<uint> right, ref Span<uint> temp)
87Span<uint> t = left;
93private static int SquareSelf(ref Span<uint> value, int valueLength, ref Span<uint> temp)
104Span<uint> t = value;
203ReadOnlySpan<uint> modulus, Span<uint> bits)
209ReadOnlySpan<uint> modulus, Span<uint> bits)
219Span<uint> valueCopy = (size <= StackAllocThreshold ?
238Span<uint> temp = (bits.Length <= StackAllocThreshold ?
252ReadOnlySpan<uint> modulus, Span<uint> bits)
258ReadOnlySpan<uint> modulus, Span<uint> bits)
268Span<uint> valueCopy = (size <= StackAllocThreshold ?
287Span<uint> temp = (bits.Length <= StackAllocThreshold ?
308private static void PowCore(Span<uint> value, int valueLength,
310Span<uint> temp, Span<uint> bits)
318Span<uint> result = PowCore(value, valueLength, power, modulus, bits, 1, temp);
326Span<uint> r = ((uint)size <= StackAllocThreshold ?
333Span<uint> mu = ((uint)size <= StackAllocThreshold ?
340Span<uint> q1 = ((uint)size <= StackAllocThreshold ?
346Span<uint> q2 = ((uint)size <= StackAllocThreshold ?
356Span<uint> result = PowCore(value, valueLength, power, reducer, bits, 1, temp);
369private static void PowCore(Span<uint> value, int valueLength,
371Span<uint> temp, Span<uint> bits)
378Span<uint> result = PowCore(value, valueLength, power, modulus, bits, 1, temp);
386Span<uint> r = ((uint)size <= StackAllocThreshold ?
393Span<uint> mu = ((uint)size <= StackAllocThreshold ?
400Span<uint> q1 = ((uint)size <= StackAllocThreshold ?
406Span<uint> q2 = ((uint)size <= StackAllocThreshold ?
416Span<uint> result = PowCore(value, valueLength, power, reducer, bits, 1, temp);
429private static Span<uint> PowCore(Span<uint> value, int valueLength,
431Span<uint> result, int resultLength,
432Span<uint> temp)
459private static Span<uint> PowCore(Span<uint> value, int valueLength,
461Span<uint> result, int resultLength,
462Span<uint> temp)
488private static Span<uint> PowCore(Span<uint> value, int valueLength,
490Span<uint> result, int resultLength,
491Span<uint> temp)
518private static Span<uint> PowCore(Span<uint> value, int valueLength,
520Span<uint> result, int resultLength,
521Span<uint> temp)
System\Numerics\BigIntegerCalculator.SquMul.cs (19)
21public static void Square(ReadOnlySpan<uint> value, Span<uint> bits)
89Span<uint> bitsLow = bits.Slice(0, n2);
90Span<uint> bitsHigh = bits.Slice(n2);
100Span<uint> fold = ((uint)foldLength <= StackAllocThreshold ?
107Span<uint> core = ((uint)coreLength <= StackAllocThreshold ?
131public static void Multiply(ReadOnlySpan<uint> left, uint right, Span<uint> bits)
159public static void Multiply(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> bits)
217Span<uint> bitsLow = bits.Slice(0, n + right.Length);
218Span<uint> bitsHigh = bits.Slice(n);
225Span<uint> carry = ((uint)carryLength <= StackAllocThreshold ?
229Span<uint> carryOrig = bits.Slice(n, right.Length);
247static void MultiplyKaratsuba(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> bits, int n)
269Span<uint> bitsLow = bits.Slice(0, n + n);
270Span<uint> bitsHigh = bits.Slice(n + n);
284Span<uint> leftFold = ((uint)foldLength <= StackAllocThreshold ?
290Span<uint> rightFold = ((uint)foldLength <= StackAllocThreshold ?
303Span<uint> core = ((uint)coreLength <= StackAllocThreshold ?
331static void Naive(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> bits)
362private static void SubtractCore(ReadOnlySpan<uint> left, ReadOnlySpan<uint> right, Span<uint> core)
System\Numerics\Complex.cs (4)
2211/// <inheritdoc cref="ISpanFormattable.TryFormat(Span{char}, out int, ReadOnlySpan{char}, IFormatProvider?)" />
2212public bool TryFormat(Span<char> destination, out int charsWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
2215public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, [StringSyntax(StringSyntaxAttribute.NumericFormat)] ReadOnlySpan<char> format = default, IFormatProvider? provider = null) =>
2218private bool TryFormatCore<TChar>(Span<TChar> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) where TChar : unmanaged, IBinaryInteger<TChar>
System.Security.Cryptography (687)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs (10)
27Span<byte> md,
38private static unsafe partial int EvpDigestFinalXOF(SafeEvpMdCtxHandle ctx, Span<byte> md, uint len);
41private static unsafe partial int EvpDigestCurrentXOF(SafeEvpMdCtxHandle ctx, Span<byte> md, uint len);
50private static unsafe partial int EvpDigestXOFOneShot(IntPtr type, ReadOnlySpan<byte> source, int sourceSize, Span<byte> md, uint len);
66Span<byte> pDestination,
74Span<byte> destination)
87internal static unsafe int EvpDigestFinalXOF(SafeEvpMdCtxHandle ctx, Span<byte> destination)
92internal static unsafe int EvpDigestCurrentXOF(SafeEvpMdCtxHandle ctx, Span<byte> destination)
97internal static unsafe int EvpDigestXOFOneShot(IntPtr type, ReadOnlySpan<byte> source, Span<byte> destination)
102internal static int EvpDigestSqueeze(SafeEvpMdCtxHandle ctx, Span<byte> destination)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
src\libraries\Common\src\System\Security\Cryptography\RSAOpenSsl.cs (15)
92Span<byte> destination = default;
111Span<byte> destination,
127Span<byte> tmp = stackalloc byte[512];
171Span<byte> destination,
232public override bool TryEncrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding, out int bytesWritten)
245Span<byte> destination,
301private bool TryExportPrivateKey(TryExportPrivateKeySelector selector, Span<byte> destination, out int bytesWritten)
339Span<byte> destination,
364public override bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten)
374public override bool TryExportRSAPrivateKey(Span<byte> destination, out int bytesWritten)
395public override bool TryExportRSAPublicKey(Span<byte> destination, out int bytesWritten)
413public override bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten)
737Span<byte>.Empty,
753Span<byte> destination,
776Span<byte> destination,
src\libraries\Common\src\System\Security\Cryptography\RsaPaddingProcessor.cs (28)
120Span<byte> destination)
134Span<byte> mInEM = destination.Slice(destination.Length - source.Length);
135Span<byte> ps = destination.Slice(2, destination.Length - source.Length - 3);
148Span<byte> destination,
252Span<byte> destination)
291Span<byte> destination)
297Span<byte> dbMaskSpan = Span<byte>.Empty;
316Span<byte> seed = destination.Slice(1, hLen);
317Span<byte> db = destination.Slice(1 + hLen);
324Span<byte> lHash = db.Slice(0, hLen);
325Span<byte> mDest = db.Slice(db.Length - source.Length);
326Span<byte> ps = db.Slice(hLen, db.Length - hLen - 1 - mDest.Length);
327Span<byte> psEnd = db.Slice(hLen + ps.Length, 1);
357Span<byte> seedMask = stackalloc byte[hLen];
382internal static void EncodePss(HashAlgorithmName hashAlgorithmName, ReadOnlySpan<byte> mHash, Span<byte> destination, int keySize)
412Span<byte> em = destination.Slice(destination.Length - emLen, emLen);
416Span<byte> db = em.Slice(0, dbLen);
417Span<byte> hDest = em.Slice(dbLen, hLen);
421Span<byte> dbMask = new Span<byte>(dbMaskRented, 0, dbLen);
427Span<byte> salt = stackalloc byte[sLen];
518Span<byte> dbMask = new Span<byte>(dbMaskRented, 0, maskedDb.Length);
562Span<byte> hPrime = stackalloc byte[hLen];
585private static void Mgf1(IncrementalHash hasher, ReadOnlySpan<byte> mgfSeed, Span<byte> mask)
588Span<byte> writePtr = mask;
590Span<byte> bigEndianCount = stackalloc byte[sizeof(int)];
611Span<byte> tmp = stackalloc byte[hLen];
631private static void Xor(Span<byte> a, ReadOnlySpan<byte> b)
src\libraries\Common\src\System\Security\Cryptography\SP800108HmacCounterKdf.cs (8)
283public static void DeriveBytes(ReadOnlySpan<byte> key, HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, Span<byte> destination)
363public static void DeriveBytes(ReadOnlySpan<byte> key, HashAlgorithmName hashAlgorithm, ReadOnlySpan<char> label, ReadOnlySpan<char> context, Span<byte> destination)
443public void DeriveKey(ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, Span<byte> destination)
494public void DeriveKey(ReadOnlySpan<char> label, ReadOnlySpan<char> context, Span<byte> destination)
599Span<byte> destination);
606Span<byte> destination);
608private void DeriveKeyCore(ReadOnlySpan<byte> label, ReadOnlySpan<byte> context, Span<byte> destination)
613private void DeriveKeyCore(ReadOnlySpan<char> label, ReadOnlySpan<char> context, Span<byte> destination)
System\Security\Cryptography\AesCcm.OpenSsl.cs (7)
29Span<byte> ciphertext,
30Span<byte> tag,
46Interop.Crypto.EvpCipherSetKeyAndIV(ctx, Span<byte>.Empty, Span<byte>.Empty, Interop.Crypto.EvpCipherDirection.Encrypt);
56if (!Interop.Crypto.EvpCipherUpdate(ctx, Span<byte>.Empty, out _, associatedData))
99Span<byte> plaintext,
122if (!Interop.Crypto.EvpCipherUpdate(ctx, Span<byte>.Empty, out _, associatedData))
System\Security\Cryptography\AesGcm.OpenSsl.cs (7)
26Span<byte>.Empty,
34Span<byte> ciphertext,
35Span<byte> tag,
40Span<byte>.Empty,
46if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
80Span<byte> plaintext,
91if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
System\Security\Cryptography\AsymmetricAlgorithm.cs (20)
145Span<byte> destination,
154Span<byte> destination,
160public virtual bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten) =>
163public virtual bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten) =>
425/// <see cref="TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan{char}, PbeParameters, Span{byte}, out int)" /> has not been provided.
478/// <see cref="TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan{byte}, PbeParameters, Span{byte}, out int)" /> has not been provided.
578public bool TryExportSubjectPublicKeyInfoPem(Span<char> destination, out int charsWritten)
580static bool Export(AsymmetricAlgorithm alg, Span<byte> destination, out int bytesWritten)
627public bool TryExportPkcs8PrivateKeyPem(Span<char> destination, out int charsWritten)
629static bool Export(AsymmetricAlgorithm alg, Span<byte> destination, out int bytesWritten)
665/// An implementation for <see cref="TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan{char}, PbeParameters, Span{byte}, out int)" />
688public bool TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<char> destination, out int charsWritten)
694Span<byte> destination,
732/// An implementation for <see cref="TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan{byte}, PbeParameters, Span{byte}, out int)" />
750public bool TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<char> destination, out int charsWritten)
756Span<byte> destination,
774Span<byte> destination,
777private delegate bool TryExport(Span<byte> destination, out int bytesWritten);
798Span<byte> writtenSpan = new Span<byte>(buf, 0, bytesWritten);
828Span<byte> writtenSpan = new Span<byte>(buf, 0, bytesWritten);
System\Security\Cryptography\ChaCha20Poly1305.OpenSsl.cs (7)
26Span<byte>.Empty,
33Span<byte> ciphertext,
34Span<byte> tag,
39Span<byte>.Empty,
45if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
79Span<byte> plaintext,
90if (!Interop.Crypto.EvpCipherUpdate(_ctxHandle, Span<byte>.Empty, out _, associatedData))
System\Security\Cryptography\CryptographicOperations.cs (7)
61public static void ZeroMemory(Span<byte> buffer)
149public static int HashData(HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> source, Span<byte> destination)
185public static bool TryHashData(HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> source, Span<byte> destination, out int bytesWritten)
262public static int HashData(HashAlgorithmName hashAlgorithm, Stream source, Span<byte> destination)
458Span<byte> destination)
499Span<byte> destination,
612public static int HmacData(HashAlgorithmName hashAlgorithm, ReadOnlySpan<byte> key, Stream source, Span<byte> destination)
System\Security\Cryptography\DSA.cs (16)
227Span<byte> signature = stackalloc byte[SignatureStackSize];
434Span<byte> signature = stackalloc byte[SignatureStackSize];
446public virtual bool TryCreateSignature(ReadOnlySpan<byte> hash, Span<byte> destination, out int bytesWritten)
472Span<byte> destination,
502Span<byte> destination,
521Span<byte> destination,
539Span<byte> destination,
582Span<byte> destination,
615Span<byte> destination,
620Span<byte> tmp = stackalloc byte[HashBufferStackSize];
781Span<byte> tmp = stackalloc byte[HashBufferStackSize];
881Span<byte> tmp)
924Span<byte> destination,
947Span<byte> destination,
967Span<byte> destination,
975Span<byte> destination,
System\Security\Cryptography\ECDsa.cs (24)
141Span<byte> signature = stackalloc byte[SignatureStackBufSize];
363/// <seealso cref="SignHash(ReadOnlySpan{byte}, Span{byte})" />.
364public int SignHash(ReadOnlySpan<byte> hash, Span<byte> destination, DSASignatureFormat signatureFormat)
397/// the signature. To use a different signature format, use <see cref="SignHash(ReadOnlySpan{byte}, Span{byte}, DSASignatureFormat)" />.
399/// <seealso cref="SignHash(ReadOnlySpan{byte}, Span{byte}, DSASignatureFormat)" />.
400public int SignHash(ReadOnlySpan<byte> hash, Span<byte> destination)
423Span<byte> signature = stackalloc byte[SignatureStackBufSize];
464Span<byte> destination,
470Span<byte> hashTmp = stackalloc byte[HashBufferStackSize];
502Span<byte> destination,
535Span<byte> destination,
540Span<byte> hashTmp = stackalloc byte[HashBufferStackSize];
654/// <seealso cref="SignData(ReadOnlySpan{byte}, Span{byte}, HashAlgorithmName)" />
657Span<byte> destination,
704/// <see cref="SignData(ReadOnlySpan{byte}, Span{byte}, HashAlgorithmName, DSASignatureFormat)" />.
706/// <seealso cref="SignData(ReadOnlySpan{byte}, Span{byte}, HashAlgorithmName, DSASignatureFormat)" />
707public int SignData(ReadOnlySpan<byte> data, Span<byte> destination, HashAlgorithmName hashAlgorithm)
845Span<byte> hashTmp = stackalloc byte[HashBufferStackSize];
899Span<byte> hashSpan = stackalloc byte[512 / 8];
998protected virtual bool TryHashData(ReadOnlySpan<byte> data, Span<byte> destination, HashAlgorithmName hashAlgorithm, out int bytesWritten)
1041public virtual bool TrySignHash(ReadOnlySpan<byte> hash, Span<byte> destination, out int bytesWritten)
1067Span<byte> destination,
1097Span<byte> destination,
1201Span<byte> tmp)
System\Security\Cryptography\HKDF.cs (14)
48public static int Extract(HashAlgorithmName hashAlgorithmName, ReadOnlySpan<byte> ikm, ReadOnlySpan<byte> salt, Span<byte> prk)
66private static void Extract(HashAlgorithmName hashAlgorithmName, int hashLength, ReadOnlySpan<byte> ikm, ReadOnlySpan<byte> salt, Span<byte> prk)
112public static void Expand(HashAlgorithmName hashAlgorithmName, ReadOnlySpan<byte> prk, Span<byte> output, ReadOnlySpan<byte> info)
127private static void Expand(HashAlgorithmName hashAlgorithmName, int hashLength, ReadOnlySpan<byte> prk, Span<byte> output, ReadOnlySpan<byte> info)
135var counterSpan = new Span<byte>(ref counter);
136Span<byte> t = Span<byte>.Empty;
137Span<byte> remainingOutput = output;
140Span<byte> tempInfoBuffer = stackalloc byte[MaxStackInfoBuffer];
181Span<byte> lastChunk = stackalloc byte[hashLength];
222Span<byte> prk = stackalloc byte[hashLength];
241public static void DeriveKey(HashAlgorithmName hashAlgorithmName, ReadOnlySpan<byte> ikm, Span<byte> output, ReadOnlySpan<byte> salt, ReadOnlySpan<byte> info)
254Span<byte> prk = stackalloc byte[hashLength];
260private static void GetHashAndReset(IncrementalHash hmac, Span<byte> output)
System\Security\Cryptography\PemEncoding.cs (7)
80Span<char> postebStackBuffer = stackalloc char[PostebStackBufferSize];
119Span<char> postebBuffer = postebLength > PostebStackBufferSize
168static ReadOnlySpan<char> WritePostEB(ReadOnlySpan<char> label, Span<char> destination)
377public static bool TryWrite(ReadOnlySpan<char> label, ReadOnlySpan<byte> data, Span<char> destination, out int charsWritten)
395private static int WriteCore(ReadOnlySpan<char> label, ReadOnlySpan<byte> data, Span<char> destination)
397static int Write(ReadOnlySpan<char> str, Span<char> dest, int offset)
403static int WriteBase64(ReadOnlySpan<byte> bytes, Span<char> dest, int offset)
System\Security\Cryptography\PemKeyHelpers.cs (8)
12public delegate bool TryExportKeyAction<T>(T arg, Span<byte> destination, out int bytesWritten);
17Span<byte> destination,
25Span<char> destination,
43Span<byte> writtenSpan = new Span<byte>(buffer, 0, bytesWritten);
61Span<char> destination,
79Span<byte> writtenSpan = new Span<byte>(buffer, 0, bytesWritten);
151Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten);
237Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten);
System\Security\Cryptography\RandomNumberGenerator.cs (17)
56public virtual void GetBytes(Span<byte> data)
79public virtual void GetNonZeroBytes(Span<byte> data)
98public static void Fill(Span<byte> data)
129Span<byte> oneUintBytes = MemoryMarshal.AsBytes(new Span<uint>(ref oneUint));
178/// <seealso cref="GetHexString(Span{char}, bool)" />
179public static void GetItems<T>(ReadOnlySpan<T> choices, Span<T> destination)
201/// <seealso cref="GetHexString(Span{char}, bool)" />
226/// <seealso cref="GetItems{T}(ReadOnlySpan{T}, Span{T})" />
228/// <seealso cref="GetHexString(Span{char}, bool)" />
255/// The behavior of this is the same as using <seealso cref="GetItems{T}(ReadOnlySpan{T}, Span{T})" /> and
259public static void GetHexString(Span<char> destination, bool lowercase = false)
294public static void Shuffle<T>(Span<T> values)
311private static void GetHexStringCore(Span<char> destination, bool lowercase)
316Span<byte> randomBuffer = stackalloc byte[RandomBufferSize];
322Span<byte> remainingRandom = randomBuffer.Slice(0, Math.Min(RandomBufferSize, needed));
352private static void GetItemsCore<T>(ReadOnlySpan<T> choices, Span<T> destination)
364Span<byte> randomBytes = stackalloc byte[512];
System\Security\Cryptography\RSA.cs (21)
102public virtual bool TryDecrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding, out int bytesWritten)
117public virtual bool TryEncrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding, out int bytesWritten)
159/// <seealso cref="Encrypt(ReadOnlySpan{byte}, Span{byte}, RSAEncryptionPadding)" />
211public int Encrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding)
246/// <seealso cref="Decrypt(ReadOnlySpan{byte}, Span{byte}, RSAEncryptionPadding)" />
294public int Decrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding)
306protected virtual bool TryHashData(ReadOnlySpan<byte> data, Span<byte> destination, HashAlgorithmName hashAlgorithm, out int bytesWritten)
341public virtual bool TrySignHash(ReadOnlySpan<byte> hash, Span<byte> destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten)
411public virtual bool TrySignData(ReadOnlySpan<byte> data, Span<byte> destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten)
517Span<byte> destination,
619Span<byte> destination,
705public virtual bool TryExportRSAPrivateKey(Span<byte> destination, out int bytesWritten)
717public virtual bool TryExportRSAPublicKey(Span<byte> destination, out int bytesWritten)
723public override unsafe bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten)
759public override bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten)
804Span<byte> destination,
827Span<byte> destination,
1332public bool TryExportRSAPrivateKeyPem(Span<char> destination, out int charsWritten)
1334static bool Export(RSA alg, Span<byte> destination, out int bytesWritten)
1378public bool TryExportRSAPublicKeyPem(Span<char> destination, out int charsWritten)
1380static bool Export(RSA alg, Span<byte> destination, out int bytesWritten)
System\Security\Cryptography\RSACryptoServiceProvider.Unix.cs (4)
64public override bool TryDecrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding, out int bytesWritten)
103public override bool TryEncrypt(ReadOnlySpan<byte> data, Span<byte> destination, RSAEncryptionPadding padding, out int bytesWritten)
205public override bool TrySignData(ReadOnlySpan<byte> data, Span<byte> destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten)
242public override bool TrySignHash(ReadOnlySpan<byte> hash, Span<byte> destination, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, out int bytesWritten)
System\Security\Cryptography\RSAWrapper.cs (10)
71Span<byte> destination,
78Span<byte> destination,
85Span<byte> destination,
119Span<byte> destination,
143public override bool TryExportRSAPrivateKey(Span<byte> destination, out int bytesWritten) =>
148public override bool TryExportRSAPublicKey(Span<byte> destination, out int bytesWritten) =>
151public override bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten) =>
154public override bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten) =>
160Span<byte> destination,
167Span<byte> destination,
System\Security\Cryptography\SymmetricAlgorithm.cs (19)
509public int DecryptEcb(ReadOnlySpan<byte> ciphertext, Span<byte> destination, PaddingMode paddingMode)
538public bool TryDecryptEcb(ReadOnlySpan<byte> ciphertext, Span<byte> destination, PaddingMode paddingMode, out int bytesWritten)
627public int EncryptEcb(ReadOnlySpan<byte> plaintext, Span<byte> destination, PaddingMode paddingMode)
656public bool TryEncryptEcb(ReadOnlySpan<byte> plaintext, Span<byte> destination, PaddingMode paddingMode, out int bytesWritten)
724Span<byte> decryptBuffer = decryptRent.AsSpan(0, ciphertext.Length);
769Span<byte> destination,
808Span<byte> destination,
922Span<byte> destination,
961Span<byte> destination,
1141Span<byte> destination,
1200Span<byte> destination,
1373Span<byte> destination,
1432Span<byte> destination,
1466Span<byte> destination,
1490Span<byte> destination,
1521Span<byte> destination,
1547Span<byte> destination,
1575Span<byte> destination,
1608Span<byte> destination,
System.Security.Cryptography.Cose (32)
System\Security\Cryptography\Cose\CoseHelpers.cs (10)
60Span<byte> buffer = stackalloc byte[1 + sizeof(ushort)];
68Span<byte> buffer = stackalloc byte[1 + sizeof(uint)];
76Span<byte> buffer = stackalloc byte[1 + sizeof(ulong)];
107internal static int SignHash(CoseSigner signer, IncrementalHash hasher, Span<byte> destination)
124private static int SignHashWithECDsa(ECDsa key, IncrementalHash hasher, Span<byte> destination)
132Span<byte> hash = stackalloc byte[hasher.HashLengthInBytes];
145private static int SignHashWithRSA(RSA key, IncrementalHash hasher, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding, Span<byte> destination)
153Span<byte> hash = stackalloc byte[hasher.HashLengthInBytes];
321internal static int WriteHeaderMap(Span<byte> buffer, CborWriter writer, CoseHeaderMap? headerMap, bool isProtected, int? algHeaderValueToSlip)
350internal static void WriteSignature(Span<byte> buffer, IncrementalHash hasher, CborWriter writer, CoseSigner signer)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (7)
319public static bool TrySignDetached(ReadOnlySpan<byte> detachedContent, Span<byte> destination, CoseSigner signer, out int bytesWritten, CoseHeaderMap? protectedHeaders = null, CoseHeaderMap? unprotectedHeaders = null, ReadOnlySpan<byte> associatedData = default)
347public static bool TrySignEmbedded(ReadOnlySpan<byte> embeddedContent, Span<byte> destination, CoseSigner signer, out int bytesWritten, CoseHeaderMap? protectedHeaders = null, CoseHeaderMap? unprotectedHeaders = null, ReadOnlySpan<byte> associatedData = default)
350private static bool TrySign(ReadOnlySpan<byte> content, Span<byte> destination, CoseSigner signer, CoseHeaderMap? protectedHeaders, CoseHeaderMap? unprotectedHeaders, out int bytesWritten, ReadOnlySpan<byte> associatedData, bool isDetached)
373Span<byte> buffer,
448Span<byte> buffer,
574public override bool TryEncode(Span<byte> destination, out int bytesWritten)
797Span<byte> bufferSpan = buffer;
System\Security\Cryptography\Cose\CoseSign1Message.cs (6)
263public static bool TrySignDetached(ReadOnlySpan<byte> detachedContent, Span<byte> destination, CoseSigner signer, out int bytesWritten, ReadOnlySpan<byte> associatedData = default)
285public static bool TrySignEmbedded(ReadOnlySpan<byte> embeddedContent, Span<byte> destination, CoseSigner signer, out int bytesWritten, ReadOnlySpan<byte> associatedData = default)
288private static bool TrySign(ReadOnlySpan<byte> content, Span<byte> destination, CoseSigner signer, out int bytesWritten, ReadOnlySpan<byte> associatedData, bool isDetached)
321private static int CreateCoseSign1Message(ReadOnlySpan<byte> contentBytes, Stream? contentStream, Span<byte> buffer, CoseSigner signer, ReadOnlySpan<byte> associatedData, bool isDetached)
747Span<byte> hash = stackalloc byte[hasher.HashLengthInBytes];
802public override bool TryEncode(Span<byte> destination, out int bytesWritten)
System.Text.Encoding.CodePages (2)
System.Text.Encodings.Web (56)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (6)
35private protected override OperationStatus EncodeCore(ReadOnlySpan<char> source, Span<char> destination, out int charsConsumed, out int charsWritten, bool isFinalBlock)
38private protected override OperationStatus EncodeUtf8Core(ReadOnlySpan<byte> utf8Source, Span<byte> utf8Destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock)
67internal override int EncodeUtf8(Rune value, Span<byte> destination)
99static int TryEncodeScalarAsHex(object @this, uint scalarValue, Span<byte> destination)
133internal override int EncodeUtf16(Rune value, Span<char> destination)
165static int TryEncodeScalarAsHex(object @this, uint scalarValue, Span<char> destination)
System\Text\Encodings\Web\DefaultJavaScriptEncoder.cs (6)
47private protected override OperationStatus EncodeCore(ReadOnlySpan<char> source, Span<char> destination, out int charsConsumed, out int charsWritten, bool isFinalBlock)
50private protected override OperationStatus EncodeUtf8Core(ReadOnlySpan<byte> utf8Source, Span<byte> utf8Destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock)
113internal override int EncodeUtf8(Rune value, Span<byte> destination)
129static int TryEncodeScalarAsHex(object @this, Rune value, Span<byte> destination)
164internal override int EncodeUtf16(Rune value, Span<char> destination)
180static int TryEncodeScalarAsHex(object @this, Rune value, Span<char> destination)
System\Text\Encodings\Web\DefaultUrlEncoder.cs (4)
110private protected override OperationStatus EncodeCore(ReadOnlySpan<char> source, Span<char> destination, out int charsConsumed, out int charsWritten, bool isFinalBlock)
113private protected override OperationStatus EncodeUtf8Core(ReadOnlySpan<byte> utf8Source, Span<byte> utf8Destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock)
142internal override int EncodeUtf8(Rune value, Span<byte> destination)
171internal override int EncodeUtf16(Rune value, Span<char> destination)
System\Text\Encodings\Web\SpanUtility.cs (8)
22public static bool IsValidIndex<T>(Span<T> span, int index)
35public static bool TryWriteBytes(Span<byte> span, byte a, byte b, byte c, byte d)
65public static bool TryWriteBytes(Span<byte> span, byte a, byte b, byte c, byte d, byte e)
97public static bool TryWriteBytes(Span<byte> span, byte a, byte b, byte c, byte d, byte e, byte f)
132public static bool TryWriteChars(Span<char> span, char a, char b, char c, char d)
162public static bool TryWriteChars(Span<char> span, char a, char b, char c, char d, char e)
194public static bool TryWriteChars(Span<char> span, char a, char b, char c, char d, char e, char f)
226public static bool TryWriteUInt64LittleEndian(Span<byte> span, int offset, ulong value)
System\Text\Encodings\Web\TextEncoder.cs (12)
42private unsafe bool TryEncodeUnicodeScalar(uint unicodeScalar, Span<char> buffer, out int charsWritten)
50private bool TryEncodeUnicodeScalarUtf8(uint unicodeScalar, Span<char> utf16ScratchBuffer, Span<byte> utf8Destination, out int bytesWritten)
166Span<char> destBuffer = stringBuilder.AppendSpan(Math.Max(remainingInput.Length, minBufferBumpEachIteration));
279Span<byte> utf8Destination,
324Span<byte> utf8Destination,
333Span<char> utf16ScratchBuffer = stackalloc char[TempUtf16CharBufferLength];
409Span<char> destination,
452private protected virtual OperationStatus EncodeCore(ReadOnlySpan<char> source, Span<char> destination, out int charsConsumed, out int charsWritten, bool isFinalBlock)
522Span<char> scratchBuffer = rentedArray;
576internal static bool TryCopyCharacters(string source, Span<char> destination, out int numberOfCharactersWritten)
596internal static bool TryWriteScalarAsChar(int unicodeScalar, Span<char> destination, out int numberOfCharactersWritten)
System.Text.Json (256)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System\Text\Json\Reader\JsonReaderHelper.Unescaping.cs (14)
18Span<byte> utf8Unescaped = utf8Source.Length <= JsonConstants.StackallocByteThreshold ?
48Span<byte> utf8Unescaped = length <= JsonConstants.StackallocByteThreshold ?
75Span<byte> utf8Unescaped = length <= JsonConstants.StackallocByteThreshold ?
100Span<byte> utf8Unescaped = utf8Source.Length <= JsonConstants.StackallocByteThreshold ?
131Span<byte> utf8Unescaped = length <= JsonConstants.StackallocByteThreshold ?
135Span<byte> utf8Escaped = length <= JsonConstants.StackallocByteThreshold ?
162public static bool TryDecodeBase64InPlace(Span<byte> utf8Unescaped, [NotNullWhen(true)] out byte[]? bytes)
178Span<byte> byteSpan = utf8Unescaped.Length <= JsonConstants.StackallocByteThreshold ?
240public static int TranscodeHelper(ReadOnlySpan<byte> utf8Unescaped, Span<char> destination)
347internal static int GetUtf8FromText(ReadOnlySpan<char> text, Span<byte> dest)
400internal static void Unescape(ReadOnlySpan<byte> source, Span<byte> destination, out int written)
411internal static void Unescape(ReadOnlySpan<byte> source, Span<byte> destination, int idx, out int written)
424internal static bool TryUnescape(ReadOnlySpan<byte> source, Span<byte> destination, out int written)
435private static bool TryUnescape(ReadOnlySpan<byte> source, Span<byte> destination, int idx, out int written)
System\Text\Json\Writer\JsonWriterHelper.Escaping.cs (6)
82private static void EscapeString(ReadOnlySpan<byte> value, Span<byte> destination, JavaScriptEncoder encoder, ref int written)
101public static void EscapeString(ReadOnlySpan<byte> value, Span<byte> destination, int indexOfFirstByteToEscape, JavaScriptEncoder? encoder, out int written)
147private static void EscapeNextBytes(byte value, Span<byte> destination, ref int written)
193private static void EscapeString(ReadOnlySpan<char> value, Span<char> destination, JavaScriptEncoder encoder, ref int written)
212public static void EscapeString(ReadOnlySpan<char> value, Span<char> destination, int indexOfFirstByteToEscape, JavaScriptEncoder? encoder, out int written)
258private static void EscapeNextChars(char value, Span<char> destination, ref int written)
System.Text.Json.SourceGeneration (20)
System.Text.RegularExpressions (51)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Text.RegularExpressions.Generator (42)
src\libraries\Common\src\System\HexConverter.cs (6)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
183Span<char> result = bytes.Length > 16 ?
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
System.Web.HttpUtility (5)
src\libraries\Common\src\System\HexConverter.cs (5)
72public static void ToBytesBuffer(byte value, Span<byte> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
82public static void ToCharsBuffer(byte value, Span<char> buffer, int startingIndex = 0, Casing casing = Casing.Upper)
163public static void EncodeToUtf16(ReadOnlySpan<byte> bytes, Span<char> chars, Casing casing = Casing.Upper)
230public static bool TryDecodeFromUtf16(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)
330private static bool TryDecodeFromUtf16_Scalar(ReadOnlySpan<char> chars, Span<byte> bytes, out int charsProcessed)