755 references to AsSpan
Aspire.Hosting (1)
Utils\HashDigestStream.cs (1)
26_hashAlgorithm.Append(buffer.AsSpan(offset, count));
Aspire.Hosting.Docker (1)
EnvVarEscaper.cs (1)
225var strippedSpan = stripped.AsSpan(0, strippedLength);
http2cat (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
IIS.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
IIS.LongTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
IIS.NewHandler.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
IIS.NewShim.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
IISExpress.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
InMemory.FunctionalTests (7)
Http2\Http2ConnectionTests.cs (7)
3375Assert.True(_helloWorldBytes.AsSpan(0, initialWindowSize).SequenceEqual(dataFrame.PayloadSequence.ToArray())); 4382Assert.True(_helloWorldBytes.AsSpan(0, initialWindowSize).SequenceEqual(dataFrame.PayloadSequence.ToArray())); 4710Assert.True(_helloWorldBytes.AsSpan(0, initialWindowSize).SequenceEqual(dataFrame1.PayloadSequence.ToArray())); 4711Assert.True(_helloWorldBytes.AsSpan(initialWindowSize, initialWindowSize).SequenceEqual(dataFrame2.PayloadSequence.ToArray())); 4765Assert.True(_helloWorldBytes.AsSpan(0, 6).SequenceEqual(dataFrame1.PayloadSequence.ToArray())); 4766Assert.True(_helloWorldBytes.AsSpan(6, 3).SequenceEqual(dataFrame2.PayloadSequence.ToArray())); 4767Assert.True(_helloWorldBytes.AsSpan(9, 3).SequenceEqual(dataFrame3.PayloadSequence.ToArray()));
Microsoft.AspNetCore.Components (3)
ParameterView.cs (1)
126_frames.AsSpan(1, numEntries).CopyTo(cloneBuffer.AsSpan(1));
Routing\RouteContext.cs (1)
62Buffer = _pooled.AsSpan(0, length);
src\Components\Shared\src\ArrayBuilder.cs (1)
81=> Append(source.AsSpan(startIndex, length));
Microsoft.AspNetCore.Components.Endpoints (1)
Builder\ResourceCollectionUrlEndpoint.cs (1)
148incrementalHash.AppendData(rented.AsSpan(0, bytesWritten));
Microsoft.AspNetCore.Components.Server (9)
src\Components\Shared\src\ArrayBuilder.cs (1)
81=> Append(source.AsSpan(startIndex, length));
src\Shared\PooledArrayBufferWriter.cs (2)
82_rentedBuffer.AsSpan(0, _index).Clear(); 168var previousBuffer = oldBuffer.AsSpan(0, _index);
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.Components.WebView (1)
src\Components\Shared\src\ArrayBuilder.cs (1)
81=> Append(source.AsSpan(startIndex, length));
Microsoft.AspNetCore.Cryptography.Internal.Tests (4)
CryptoUtilTests.cs (4)
19Assert.True(CryptoUtil.TimeConstantBuffersAreEqual(a.AsSpan(1, 3), b.AsSpan(2, 3))); 29Assert.False(CryptoUtil.TimeConstantBuffersAreEqual(a.AsSpan(1, 3), b.AsSpan(2, 3)));
Microsoft.AspNetCore.DataProtection (8)
KeyManagement\KeyRingBasedDataProtector.cs (1)
372Span<int> purposeLengthsPool = targetLength <= 32 ? stackalloc int[targetLength] : (lease = ArrayPool<int>.Shared.Rent(targetLength)).AsSpan(0, targetLength);
Managed\ManagedAuthenticatedEncryptor.cs (7)
108operationSubkey: tempKeys.AsSpan(0, _symmetricAlgorithmSubkeyLengthInBytes), 109validationSubkey: tempKeys.AsSpan(_symmetricAlgorithmSubkeyLengthInBytes, _validationAlgorithmSubkeyLengthInBytes)); 194ReadOnlySpan<byte> keyModifier = protectedPayload.Array!.AsSpan(keyModifierOffset, ivOffset - keyModifierOffset); 253var ciphertext = protectedPayload.Array.AsSpan(ciphertextOffset, macOffset - ciphertextOffset); 254var iv = protectedPayload.Array.AsSpan(ivOffset, _symmetricAlgorithmBlockSizeInBytes); 498var hashSource = payloadArray!.AsSpan(ivOffset, macOffset - ivOffset); 525var payloadMacSpan = payloadArray!.AsSpan(macOffset, eofOffset - macOffset);
Microsoft.AspNetCore.DataProtection.Abstractions (3)
src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 255return Base64UrlEncode(input.AsSpan(offset, count)); 310return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
Microsoft.AspNetCore.Diagnostics.Middleware (2)
src\Shared\BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
Microsoft.AspNetCore.Http.Connections (9)
src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 255return Base64UrlEncode(input.AsSpan(offset, count)); 310return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.Http.Connections.Common (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
81WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.Http.Extensions (1)
src\Shared\PropertyAsParameterInfo.cs (1)
92list.AddRange(parameters.AsSpan(0, i));
Microsoft.AspNetCore.HttpLogging (3)
RequestBufferingStream.cs (2)
54WriteToBuffer(buffer.AsSpan(offset, res)); 69WriteToBuffer(buffer.AsSpan(offset, res));
ResponseBufferingStream.cs (1)
48Write(buffer.AsSpan(offset, count));
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
src\Shared\PropertyAsParameterInfo.cs (1)
92list.AddRange(parameters.AsSpan(0, i));
Microsoft.AspNetCore.Mvc.ViewFeatures (2)
src\Shared\PooledArrayBufferWriter.cs (2)
82_rentedBuffer.AsSpan(0, _index).Clear(); 168var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.OpenApi (8)
src\Shared\PropertyAsParameterInfo.cs (1)
92list.AddRange(parameters.AsSpan(0, i));
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
81WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.OutputCaching (3)
RecyclableArrayBufferWriter.cs (2)
78public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray(); 120oldArray.AsSpan(0, _index).CopyTo(_buffer);
Streams\OutputCacheStream.cs (1)
125_segmentWriteStream.Write(buffer.AsSpan(offset, count));
Microsoft.AspNetCore.ResponseCaching (1)
src\Shared\SegmentWriteStream.cs (1)
130Write(buffer.AsSpan(offset, count));
Microsoft.AspNetCore.Server.HttpSys (2)
RequestProcessing\RequestContext.cs (2)
261tlsClientHelloBytesCallback(features, buffer.AsSpan(0, (int)bytesReturnedValue)); 295tlsClientHelloBytesCallback(features, buffer.AsSpan(0, correctSize));
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
Microsoft.AspNetCore.Server.Kestrel.Core (8)
Internal\Http2\Http2FrameWriter.cs (4)
643_outputWriter.Write(_headerEncodingBuffer.AsSpan(0, payloadLength)); 650_outputWriter.Write(_headerEncodingBuffer.AsSpan(0, payloadLength)); 660buffer = largeHeaderBuffer.AsSpan(0, _headersEncodingLargeBufferSize); 692buffer = largeHeaderBuffer.AsSpan(0, _headersEncodingLargeBufferSize);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
594? _headerValueOctets.AsSpan(0, _headerValueLength) 604? _headerName.AsSpan(0, _headerNameLength)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
src\Shared\test\Shared.Tests\runtime\Http3\QPackDecoderTest.cs (1)
346Span<byte> chunk = encoded.AsSpan(i, resolvedSize);
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
HttpParserBenchmark.cs (1)
23segment.SetOwnedMemory(RequestParsingData.UnicodeRequest.AsSpan(0, split).ToArray());
Microsoft.AspNetCore.Shared.Tests (20)
runtime\Http3\QPackDecoderTest.cs (1)
346Span<byte> chunk = encoded.AsSpan(i, resolvedSize);
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
594? _headerValueOctets.AsSpan(0, _headerValueLength) 604? _headerName.AsSpan(0, _headerNameLength)
src\Shared\SegmentWriteStream.cs (1)
130Write(buffer.AsSpan(offset, count));
src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 255return Base64UrlEncode(input.AsSpan(offset, count)); 310return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
UrlDecoderTests.cs (11)
21Assert.True(destination.AsSpan(0, length).SequenceEqual(expected.AsSpan())); 30Assert.True(destination.AsSpan(0, length).SequenceEqual(expected.AsSpan())); 40Assert.True(destination.AsSpan(0, length).SequenceEqual(expected.AsSpan())); 50Assert.True(destination.AsSpan(0, length).SequenceEqual(expected.AsSpan())); 57Assert.Throws<ArgumentException>(() => UrlDecoder.DecodeRequestLine(source.AsSpan(), source.AsSpan(0, 1))); 64Assert.Throws<ArgumentException>(() => UrlDecoder.DecodeRequestLine(source.AsSpan(), source.AsSpan(0, 1), false)); 108Assert.True(source.AsSpan(0, length).SequenceEqual(input.AsSpan())); 122Assert.True(source.AsSpan(0, length).SequenceEqual(Encoding.UTF8.GetBytes(input).AsSpan())); 132Assert.True(source.AsSpan(0, length).SequenceEqual(Encoding.UTF8.GetBytes("/").AsSpan())); 146Assert.True(source.AsSpan(0, length).SequenceEqual(input.AsSpan())); 160Assert.True(source.AsSpan(0, length).SequenceEqual(Encoding.UTF8.GetBytes(input).AsSpan()));
Microsoft.AspNetCore.SignalR.Client.Tests (6)
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.SignalR.Common (7)
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
81WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.SignalR.Common.Tests (3)
Internal\Protocol\MemoryBufferWriterTests.cs (3)
409bufferWriter.Write(data.AsSpan(0, MinimumSegmentSize / 2)); 420data.AsSpan(0, MinimumSegmentSize / 2).CopyTo(expectedOutput.AsSpan(0, MinimumSegmentSize / 2));
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
81WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (6)
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (7)
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
81WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.SignalR.Specification.Tests (6)
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (6)
src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.SignalR.Tests (2)
EndToEndTests.cs (2)
111Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray()); 150Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
Microsoft.AspNetCore.WebUtilities (10)
BufferedReadStream.cs (2)
397builder.Write(_buffer.AsSpan(_bufferOffset - writeCount, writeCount)); 409builder.Write(_buffer.AsSpan(_bufferOffset - writeCount, writeCount));
FileBufferingReadStream.cs (3)
290_buffer.Write(rentedBuffer.AsSpan(0, copyRead)); 301_buffer.Write(_rentedBuffer.AsSpan(0, (int)oldBuffer.Length)); 323return Read(buffer.AsSpan(offset, count));
FormPipeReader.cs (1)
364Span<byte> buffer = byteArray.AsSpan(0, (int)ros.Length);
MultipartReaderStream.cs (1)
187var slice = buffer.AsSpan(offset, Math.Min(count, index));
src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 255return Base64UrlEncode(input.AsSpan(offset, count)); 310return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
Microsoft.Build (3)
InterningBinaryReader.cs (2)
153return Strings.WeakIntern(charBuffer.AsSpan(0, charsRead)); 167var retval = Strings.WeakIntern(resultBuffer.AsSpan(0, charsRead));
Logging\OptimizedStringIndenter.cs (1)
140segments = pooledArray.AsSpan(0, segmentCount);
Microsoft.Build.Tasks.Core (3)
InterningBinaryReader.cs (2)
153return Strings.WeakIntern(charBuffer.AsSpan(0, charsRead)); 167var retval = Strings.WeakIntern(resultBuffer.AsSpan(0, charsRead));
ManifestUtil\mansign2.cs (1)
1005return Convert.ToHexStringLower(array.AsSpan(start, end - start));
Microsoft.CodeAnalysis (7)
InternalUtilities\StringTable.cs (2)
116var span = chars.AsSpan(start, len); 301if (hash == hashCode && TextEquals(e, chars.AsSpan(start, len)))
InternalUtilities\TextKeyedCache.cs (2)
117if (StringTable.TextEquals(text, chars.AsSpan(start, len))) 154if (hash == hashCode && StringTable.TextEquals(e.Text, chars.AsSpan(start, len)))
Text\SourceText.cs (3)
645var charSpan = charBuffer.AsSpan(0, charsToCopy); 1198if (!buffer1.AsSpan(0, count).SequenceEqual(buffer2.AsSpan(0, count)))
Microsoft.CodeAnalysis.CodeStyle (4)
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
116var span = chars.AsSpan(start, len); 301if (hash == hashCode && TextEquals(e, chars.AsSpan(start, len)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
97: rentedArray.AsSpan(0, decodedLength);
Microsoft.CodeAnalysis.Workspaces (4)
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
116var span = chars.AsSpan(start, len); 301if (hash == hashCode && TextEquals(e, chars.AsSpan(start, len)))
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (1)
195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
97: rentedArray.AsSpan(0, decodedLength);
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (4)
src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (2)
116var span = chars.AsSpan(start, len); 301if (hash == hashCode && TextEquals(e, chars.AsSpan(start, len)))
src\Compilers\Core\Portable\InternalUtilities\TextKeyedCache.cs (2)
117if (StringTable.TextEquals(text, chars.AsSpan(start, len))) 154if (hash == hashCode && StringTable.TextEquals(e.Text, chars.AsSpan(start, len)))
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
XxHash128Tests.cs (3)
53Assert.False(XxHash128.TryHash(input, destination.AsSpan(0, destination.Length - 1), out int bytesWritten, test.Seed)); 119Assert.Equal(XxHash128.HashToUInt128(asciiBytes.AsSpan(0, processed), test.Seed), hash.GetCurrentHashAsUInt128()); 122Assert.Equal(16, XxHash128.Hash(asciiBytes.AsSpan(0, processed), destination2, test.Seed));
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ArReader.cs (1)
118stream.ReadExactly(buffer.AsSpan(offset, count));
Microsoft.Extensions.AI (1)
Functions\AIFunctionFactory.Utilities.cs (1)
74public ReadOnlySpan<byte> GetBuffer() => _buffer.AsSpan(0, _position);
Microsoft.Extensions.AI.Abstractions (1)
Contents\DataContent.cs (1)
161_uri = array.AsSpan(0, prefixLength + dataLength).ToString();
Microsoft.Extensions.AI.AzureAIInference (1)
AzureAIInferenceEmbeddingGenerator.cs (1)
145bytes.AsSpan(0, bytesWritten).CopyTo(MemoryMarshal.AsBytes(vector.AsSpan()));
Microsoft.Extensions.AI.OpenAI (8)
src\Shared\ServerSentEvents\SseParser_1.cs (8)
137_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 217_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 293return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 313_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 334ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 343T data = _itemParser(_eventType ?? SseParser.EventTypeDefault, _dataBuffer.AsSpan(0, _dataLength)); 392ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 550if (_lineBuffer.AsSpan(0, _lineLength).StartsWith(Utf8Bom))
Microsoft.Extensions.Caching.Hybrid (9)
Internal\BufferChunk.cs (1)
65OversizedArray.AsSpan(Offset, length).CopyTo(copy);
Internal\HybridCachePayload.cs (5)
108BinaryPrimitives.WriteUInt16LittleEndian(destination.AsSpan(0, 2), UInt16SentinelPrefixPair); 109BinaryPrimitives.WriteUInt16LittleEndian(destination.AsSpan(2, 2), (ushort)_entropySource.Next(0, 0x010000)); // Next is exclusive at RHS 110BinaryPrimitives.WriteInt64LittleEndian(destination.AsSpan(4, 8), creationTime); 140payload.CopyTo(destination.AsSpan(len, payloadLength)); 142BinaryPrimitives.WriteUInt16LittleEndian(destination.AsSpan(len, 2), UInt16SentinelPrefixPair);
Internal\RecyclableArrayBufferWriter.cs (2)
132public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray(); 194oldArray.AsSpan(0, _index).CopyTo(_buffer);
Internal\TagSet.cs (1)
161string[] final = oversized.AsSpan(0, count).ToArray();
Microsoft.Extensions.Compliance.Abstractions (1)
src\Shared\RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
Microsoft.Extensions.DependencyModel (2)
DependencyContextJsonReader.cs (2)
93utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length))) 120rented.AsSpan(0, written).Clear();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (3)
src\Shared\BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
src\Shared\RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Linux\OSFileSystemTests.cs (1)
68Assert.True(b.AsSpan(0, written).SequenceEqual(new string(Content, written).AsSpan()));
Microsoft.Extensions.Http.Diagnostics (2)
src\Shared\BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
Microsoft.Extensions.Telemetry (1)
src\Shared\RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
Microsoft.JSInterop (2)
Infrastructure\DotNetDispatcher.cs (1)
229var reader = new Utf8JsonReader(buffer.AsSpan(0, count));
src\Components\Shared\src\ArrayBuilder.cs (1)
81=> Append(source.AsSpan(startIndex, length));
Microsoft.ML.Core (8)
Utilities\BigArray.cs (6)
408_entries[maMax].AsSpan(miMin, length).CopyTo(dst); 414_entries[maMin].AsSpan(miMin, BlockSize - miMin).CopyTo(dst); 416_entries[maMax].AsSpan(0, miLim).CopyTo(dst.Slice(BlockSize - miMin)); 425_entries[maMin].AsSpan(miMin, dstSoFar).CopyTo(dst); 430_entries[major].AsSpan(0, BlockSize).CopyTo(dst.Slice(dstSoFar)); 437_entries[maMax].AsSpan(0, miLim).CopyTo(dst.Slice(dstSoFar));
Utilities\Stream.cs (2)
497ReadBinaryDataIntoSpan(reader, array.AsSpan(start, count)); 717rentedArray.AsSpan(0, numElementsToReadThisChunk * sizeof(T)).CopyTo(MemoryMarshal.AsBytes(destination.Slice(0, numElementsToReadThisChunk)));
Microsoft.ML.CpuMath (6)
AlignedArray.cs (2)
115Items.AsSpan(_base, count).CopyTo(dst.Slice(index)); 123Items.AsSpan(start + _base, count).CopyTo(dst.Slice(index));
AlignedMatrix.cs (4)
183_items.CopyFrom(src.AsSpan(index, _size)); 201_items.CopyFrom(ivDst, src.AsSpan(ivSrc, _size)); 466Items.CopyFrom(src.AsSpan(ivSrc, ValueCount)); 473Items.CopyFrom(row * ColCountPhy, src.AsSpan(ivSrc, ColCount));
Microsoft.ML.CpuMath.PerformanceTests (11)
PerformanceTests.cs (3)
108testMatrixAligned.CopyFrom(src.AsSpan(0, (matrixLength - 1) * (matrixLength - 1))); 111testSrcVectorAligned.CopyFrom(src1.AsSpan(0, matrixLength - 1)); // odd input 114testDstVectorAligned.CopyFrom(dst.AsSpan(0, matrixLength));
SmallInputCpuMathPerformanceTests.cs (8)
17=> CpuMathUtils.Add(DefaultScale, dst.AsSpan(0, arrayLength)); 21=> CpuMathUtils.Scale(DefaultScale, dst.AsSpan(0, arrayLength)); 29=> CpuMathUtils.ScaleAdd(DefaultScale, DefaultScale, dst.AsSpan(0, arrayLength)); 65=> CpuMathUtils.SumSq(DefaultScale, src.AsSpan(0, arrayLength)); 69=> CpuMathUtils.SumAbs(src.AsSpan(0, arrayLength)); 73=> CpuMathUtils.SumAbs(DefaultScale, src.AsSpan(0, arrayLength)); 77=> CpuMathUtils.MaxAbs(src.AsSpan(0, arrayLength)); 81=> CpuMathUtils.MaxAbsDiff(DefaultScale, src.AsSpan(0, arrayLength));
Microsoft.ML.Data (13)
Data\BufferBuilder.cs (3)
454_values.AsSpan(0, _length).CopyTo(editor.Values); 461_values.AsSpan(0, _count).CopyTo(editor.Values); 462_indices.AsSpan(0, _count).CopyTo(editor.Indices);
DataLoadSave\Binary\Codecs.cs (3)
1096_values.AsSpan(_valuesOffset, length) 1107_values.AsSpan(_valuesOffset, count) 1109_indices.AsSpan(_indicesOffset, count)
DataLoadSave\Text\TextLoaderParser.cs (2)
426_values.AsSpan(0, _count).CopyTo(editor.Values); 433_indices.AsSpan(0, _count).CopyTo(editor.Indices);
DataView\AppendRowsDataView.cs (1)
456Utils.Shuffle(_rand, _batch.AsSpan(0, _batchEnd));
Deprecated\Vector\VectorUtils.cs (1)
420return L2DistSquaredHalfSparse(a.AsSpan(0, a.Length), b.GetValues(), b.GetIndices());
Transforms\NormalizeColumnDbl.cs (1)
278ctx.Writer.WriteDoublesNoCount(stddev.AsSpan(0, mean.Length));
Transforms\NormalizeColumnSng.cs (1)
278ctx.Writer.WriteSinglesNoCount(stddev.AsSpan(0, mean.Length));
Utils\SequencePool.cs (1)
122writer.WriteIntsNoCount(_start.AsSpan(0, _idLim + 1));
Microsoft.ML.DataView (12)
VBuffer.cs (10)
65public ReadOnlySpan<T> GetValues() => _values.AsSpan(0, _count); 80public ReadOnlySpan<int> GetIndices() => IsDense ? default : _indices.AsSpan(0, _count); 184_values.AsSpan(0, Length).CopyTo(editor.Values); 200_values.AsSpan(0, Length).CopyTo(editor.Values); 209_values.AsSpan(0, _count).CopyTo(editor.Values); 210_indices.AsSpan(0, _count).CopyTo(editor.Indices); 233_values.AsSpan(sourceIndex, length).CopyTo(editor.Values); 250_values.AsSpan(copyMin, copyCount).CopyTo(editor.Values); 294_values.AsSpan(0, Length).CopyTo(destination.Slice(destinationIndex)); 328source.AsSpan(sourceIndex, length).CopyTo(editor.Values);
VBufferEditor.cs (2)
122Values = _values.AsSpan(0, physicalValuesCount); 123Indices = !isDense || requireIndicesOnDense ? _indices.AsSpan(0, physicalValuesCount) : default;
Microsoft.ML.FastTree (9)
TreeEnsemble\InternalRegressionTree.cs (1)
400writer.WriteIntsNoCount(CategoricalSplitFeatureRanges[indexLocal].AsSpan(0, 2));
Utils\ToByteArrayExtensions.cs (8)
304buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 337buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 375buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 408buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 441buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 474buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 507buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 540buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan()));
Microsoft.ML.PCA (1)
PcaTransformer.cs (1)
160ctx.Writer.WriteSinglesNoCount(Eigenvectors[i].AsSpan(0, Dimension));
Microsoft.ML.StandardTrainers (3)
Standard\LogisticRegression\MulticlassLogisticRegression.cs (2)
257float logZ = MathUtils.SoftMax(scores.AsSpan(0, _numClasses)); 653ctx.Writer.WriteSinglesNoCount(Biases.AsSpan(0, NumberOfClasses));
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (1)
383ctx.Writer.WriteDoublesNoCount(_absentFeaturesLogProb.AsSpan(0, _labelCount));
Microsoft.ML.TestFrameworkCommon (1)
TestLogger.cs (1)
47var span = buffer.AsSpan(index, count);
Microsoft.ML.Tokenizers (7)
Model\BPETokenizer.cs (1)
868string decodedString = Helpers.GetString(bytes.AsSpan(0, bytesIndex));
Model\SentencePieceBaseModel.cs (4)
289int charCount = Helpers.GetChars(bytesPoolArray.AsSpan(0, bytesCount), charPoolArray); 291sb.Append(charPoolArray.AsSpan(0, charCount)); 627int charCount = Helpers.GetChars(bytesPoolArray.AsSpan(0, bytesCount), charPoolArray); 634charPoolArray.AsSpan(0, charCount).CopyTo(buffer);
PreTokenizer\CompositePreTokenizer.cs (1)
174foreach ((int Offset, int Length) range in preTokenizer.PreTokenize(text.AsSpan(offset, length)))
Tokenizer.cs (1)
392string result = destination.AsSpan(0, charsWritten).ToString();
Microsoft.ML.Tokenizers.Tests (6)
BpeTests.cs (4)
837Assert.Equal(beginningOfSentenceToken + text, destinationBuffer.AsSpan(0, charsWritten).ToString()); 840Assert.Equal(text, destinationBuffer.AsSpan(0, charsWritten).ToString()); 842Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length - 1), considerSpecialTokens: false, out idsConsumed, out charsWritten)); 845Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length), considerSpecialTokens: true, out idsConsumed, out charsWritten));
DoubleArrayTrieTest.cs (1)
84Assert.StartsWith(Helpers.GetString(utf8Bytes.AsSpan(0, doubleArrayResultPairs[i].Length)), key, StringComparison.Ordinal);
LlamaTests.cs (1)
914Assert.Equal(textWithSpecialTokens, destinationBuffer.AsSpan(0, charactersWritten).ToString());
Microsoft.ML.TorchSharp (11)
Roberta\Models\RobertaModel.cs (8)
116var position = torch.tensor(DataUtils.Concat<int>(Positions.AsSpan(0, allSize), Zeros.AsSpan(0, size - allSize)), 118var segment = questionSize == size - 1 ? torch.tensor(Zeros.AsSpan(0, size).ToArray(), 1, size, dtype: torch.int64, device: device) : 119torch.tensor(DataUtils.Concat<int>(Zeros.AsSpan(0, questionSize + 2), Ones.AsSpan(0, allSize - questionSize - 2), Zeros.AsSpan(0, size - allSize)), 121var attentionMask = torch.tensor(DataUtils.Concat<int>(Zeros.AsSpan(0, allSize), NegBillionPad.AsSpan(0, size - allSize)),
Roberta\Modules\AttentionSelf.cs (2)
69var contextShape = DataUtils.Concat<long>(contextLayer.shape.AsSpan(0, contextLayer.shape.Length - 2), NumAttentionHeads * AttentionHeadSize); 80var newShape = DataUtils.Concat<long>(x.shape.AsSpan(0, x.shape.Length - 1), NumAttentionHeads, AttentionHeadSize);
Roberta\QATrainer.cs (1)
927outputCache.PredictedAnswersBuffer[index] = new ReadOnlyMemory<char>(_parent.Tokenizer.Decode(_parent.Tokenizer.RobertaModel().ConvertOccurrenceRanksToIds(contextIds).ToArray().AsSpan(predictStart - questionLength - 2, predictEnd - predictStart).ToArray()).Trim().ToCharArray());
Microsoft.ML.Transforms (1)
GroupTransform.cs (1)
477_buffer.AsSpan(0, _size).CopyTo(editor.Values);
MSBuild (2)
InterningBinaryReader.cs (2)
153return Strings.WeakIntern(charBuffer.AsSpan(0, charsRead)); 167var retval = Strings.WeakIntern(resultBuffer.AsSpan(0, charsRead));
PresentationCore (2)
System\Windows\Input\Stylus\Common\StylusPointCollection.cs (1)
177data = rawPacketData.AsSpan(rawArrayStartIndex, dataLength).ToArray();
System\Windows\Media\StreamAsIStream.cs (1)
216hr = Read(buffer.AsSpan(0, (int) toRead), out read);
PresentationFramework (6)
System\Windows\Controls\Grid.cs (6)
1488tempDefinitions.AsSpan(0, count).Sort(s_spanPreferredDistributionOrderComparer); 1525tempDefinitions.AsSpan(0, count).Sort(s_spanMaxDistributionOrderComparer); 1670tempDefinitions.AsSpan(0, starDefinitionsCount).Sort(s_starDistributionOrderComparer); 1829tempDefinitions.AsSpan(0, minCount).Sort(s_minRatioComparer); 1830tempDefinitions.AsSpan(defCount, maxCount).Sort(s_maxRatioComparer); 1986tempDefinitions.AsSpan(0, starCount).Sort(s_starWeightComparer);
Shared (11)
BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
ServerSentEvents\SseParser_1.cs (8)
137_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 217_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 293return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 313_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 334ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 343T data = _itemParser(_eventType ?? SseParser.EventTypeDefault, _dataBuffer.AsSpan(0, _dataLength)); 392ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 550if (_lineBuffer.AsSpan(0, _lineLength).StartsWith(Utf8Bom))
System.Collections (7)
System\Collections\BitArray.cs (6)
289Span<int> span = m_array.AsSpan(0, arrayLength); 653m_array.AsSpan(toIndex, ints - toIndex).Clear(); 707m_array.AsSpan(0, lengthToClear).Clear(); 740m_array.AsSpan(last + 1, newints - last - 1).Clear(); 987if (m_array.AsSpan(0, intCount).ContainsAnyExcept(AllSetBits)) 1017if (m_array.AsSpan(0, intCount).ContainsAnyExcept(0))
System\Collections\Generic\PriorityQueue.cs (1)
885ReadOnlySpan<(TElement Element, TPriority Priority)> nodes = _nodes.AsSpan(0, _size);
System.Collections.Immutable (9)
System\Collections\Frozen\FrozenHashTable.cs (2)
60Span<int> bucketStarts = arrayPoolBuckets.AsSpan(0, numBuckets); 61Span<int> nexts = arrayPoolBuckets.AsSpan(numBuckets, hashCodes.Length);
System\Collections\Frozen\Int32\Int32FrozenDictionary.cs (1)
32Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Frozen\ItemsFrozenSet.cs (1)
27Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Frozen\KeysAndValuesFrozenDictionary.cs (1)
29Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Frozen\String\LengthBuckets.cs (1)
48buckets.AsSpan(0, arraySize).Fill(-1);
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (1)
44Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, keys.Length);
System\Collections\Frozen\String\OrdinalStringFrozenSet.cs (1)
35Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Immutable\ImmutableArray_1.Builder.cs (1)
970_elements.AsSpan(0, _count).Sort(comparison);
System.Console (4)
System\IO\KeyParser.cs (4)
56ReadOnlySpan<char> input = buffer.AsSpan(startIndex, endIndex - startIndex); 73if (!terminfoDb.TryGetValue(buffer.AsSpan(startIndex, MinimalSequenceLength), out parsed)) 107if (!terminfoDb.TryGetValue(buffer.AsSpan(startIndex, 4), out parsed)) 132if (!terminfoDb.TryGetValue(buffer.AsSpan(startIndex, sequenceLength), out parsed))
System.Data.Common (4)
System\Data\SQLTypes\SQLBytes.cs (4)
313return ReadNoValidation(offset, buffer.AsSpan(offsetInBuffer, count)); 389WriteNoValidation(offset, buffer.AsSpan(offsetInBuffer, count)); 422Span<byte> span = _rgbBuf.AsSpan((int)offset, buffer.Length); 733return ReadNoValidation(buffer.AsSpan(offset, count));
System.Data.Odbc (3)
System\Data\Odbc\OdbcHandle.cs (3)
191sqlState = new string(buffer.AsSpan(0, buffer.AsSpan().IndexOf('\0'))); 211sqlState = new string(buffer.AsSpan(0, buffer.AsSpan().IndexOf('\0'))); 217messageBuilder.Append(new string(message.AsSpan(0, message.AsSpan().IndexOf('\0'))));
System.Diagnostics.DiagnosticSource (2)
System\Diagnostics\Metrics\TagList.netcore.cs (2)
195_overflowTags.AsSpan(index, _tagsCount - index).CopyTo(_overflowTags.AsSpan(index + 1)); 304_overflowTags is not null ? _overflowTags.AsSpan(0, _tagsCount) :
System.Formats.Asn1 (8)
System\Formats\Asn1\AsnCharacterStringEncodings.cs (1)
221isAllowed.AsSpan(minCharAllowed, maxCharAllowed - minCharAllowed + 1).Fill(true);
System\Formats\Asn1\AsnDecoder.BitString.cs (1)
321byte[] ret = rented.AsSpan(0, written).ToArray();
System\Formats\Asn1\AsnDecoder.NamedBitList.cs (1)
353Span<byte> valueSpan = rented.AsSpan(0, written);
System\Formats\Asn1\AsnWriter.cs (2)
157_buffer.AsSpan(0, _offset).CopyTo(destination); 209return _buffer.AsSpan(0, _offset).ToArray();
System\Formats\Asn1\AsnWriter.NamedBitList.cs (1)
207Span<byte> valueSpan = rented.AsSpan(0, requiredBytes);
System\Formats\Asn1\AsnWriter.Text.cs (2)
99Span<byte> dest = _buffer.AsSpan(_offset, size); 127WriteConstructedCerOctetString(tag, tmp.AsSpan(0, size));
System.Formats.Cbor (8)
System\Formats\Cbor\Writer\CborWriter.Array.cs (2)
82ReadOnlySpan<byte> elementEncoding = _buffer.AsSpan(_frameOffset, currentOffset - _frameOffset); 83Span<byte> target = _buffer.AsSpan(_frameOffset + bytesToShift, currentOffset - _frameOffset);
System\Formats\Cbor\Writer\CborWriter.Map.cs (4)
106_buffer.AsSpan(currentKey.Offset, _offset).Clear(); 162Span<byte> tmpSpan = tempBuffer.AsSpan(0, totalMapPayloadEncodingLength); 272return _writer._buffer.AsSpan(range.Offset, range.Length); 277return _writer._buffer.AsSpan(range.Offset, range.KeyLength);
System\Formats\Cbor\Writer\CborWriter.String.cs (2)
147CborHelpers.GetBytes(utf8Encoding, value, _buffer.AsSpan(_offset, length)); 210Span<byte> tempSpan = tempBuffer.AsSpan(0, definiteLength);
System.Formats.Tar (4)
System\Formats\Tar\SubReadStream.cs (1)
102return Read(buffer.AsSpan(offset, count));
System\Formats\Tar\TarHelpers.cs (3)
64archiveStream.ReadExactly(buffer.AsSpan(0, currentLengthToRead)); 100origin.ReadExactly(buffer.AsSpan(0, currentLengthToRead)); 101destination.Write(buffer.AsSpan(0, currentLengthToRead));
System.IO.Compression (11)
System\IO\Compression\DeflateManaged\HuffmanTree.cs (4)
83literalTreeLength.AsSpan(0, 144).Fill(8); 84literalTreeLength.AsSpan(144, 112).Fill(9); 85literalTreeLength.AsSpan(256, 24).Fill(7); 86literalTreeLength.AsSpan(280, 8).Fill(8);
System\IO\Compression\DeflateManaged\InflaterManaged.cs (1)
142public int Inflate(byte[] bytes, int offset, int length) => Inflate(bytes.AsSpan(offset, length));
System\IO\Compression\DeflateManaged\OutputWindow.cs (2)
143_window.AsSpan(WindowSize - tailLen, tailLen).CopyTo(output); 146_window.AsSpan(copy_end - output.Length, output.Length).CopyTo(output);
System\IO\Compression\ZipBlocks.Async.cs (1)
198byte[] collatedHeader = dynamicHeaderSize <= StackAllocationThreshold ? new byte[dynamicHeaderSize] : arrayPoolBuffer.AsSpan(0, dynamicHeaderSize).ToArray();
System\IO\Compression\ZipBlocks.cs (2)
599Span<byte> extraFieldBuffer = extraFieldLength <= StackAllocationThreshold ? stackalloc byte[StackAllocationThreshold].Slice(0, extraFieldLength) : arrayPoolBuffer.AsSpan(0, extraFieldLength); 818Span<byte> collatedHeader = dynamicHeaderSize <= StackAllocationThreshold ? stackalloc byte[StackAllocationThreshold].Slice(0, dynamicHeaderSize) : arrayPoolBuffer.AsSpan(0, dynamicHeaderSize);
System\IO\Compression\ZipHelper.cs (1)
119Span<byte> bufferSpan = buffer.AsSpan(0, BackwardsSeekingBufferSize);
System.IO.FileSystem.Watcher (3)
System\IO\FileSystemWatcher.cs (2)
762items.AsSpan(0, index).CopyTo(newItems); 778items.AsSpan(0, index).CopyTo(newItems);
System\IO\FileSystemWatcher.Linux.cs (1)
858int lengthWithoutNullTerm = _buffer.AsSpan(position, nameLength).IndexOf((byte)'\0');
System.IO.Hashing (2)
System\IO\Hashing\NonCryptographicHashAlgorithm.cs (2)
315public override void Write(byte[] buffer, int offset, int count) => hash.Append(buffer.AsSpan(offset, count)); 328hash.Append(buffer.AsSpan(offset, count));
System.Linq (3)
System\Linq\Range.SpeedOpt.cs (1)
34FillIncrementing(array.AsSpan(arrayIndex, _end - _start), _start);
System\Linq\Repeat.SpeedOpt.cs (1)
93array.AsSpan(arrayIndex, _count).Fill(_current);
System\Linq\SkipTake.SpeedOpt.cs (1)
145Fill(_source, array.AsSpan(arrayIndex, Count), _minIndexInclusive);
System.Memory (4)
src\libraries\Common\src\System\Buffers\ArrayBufferWriter.cs (2)
63public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, _index); 96_buffer.AsSpan(0, _index).Clear();
System\Text\EncodingExtensions.cs (2)
204array.AsSpan(0, length).CopyTo(remainingBytes); 390array.AsSpan(0, length).CopyTo(span);
System.Net.Http (17)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (2)
594? _headerValueOctets.AsSpan(0, _headerValueLength) 604? _headerName.AsSpan(0, _headerNameLength)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (3)
203_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(newBlockArray); 209_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(_blocks); 212_blocks.AsSpan((int)usedBlocks, (int)unusedInitialBlocks).Clear();
System\Net\Http\Headers\HeaderUtilities.cs (1)
76ReadOnlySpan<byte> utf8 = utf8bytes.AsSpan(0, utf8length);
System\Net\Http\HttpBaseStream.cs (1)
48return Read(buffer.AsSpan(offset, count));
System\Net\Http\HttpContent.cs (5)
176string result = encoding.GetString(buffer.AsSpan(0, (int)stream.Length)[bomLength..]); 872: _lastBuffer.AsSpan(0, _totalLength); 882return _lastBuffer.AsSpan(0, _totalLength).ToArray(); 1063_lastBuffer.AsSpan(0, _lastBufferOffset).CopyTo(destination); 1098Write(buffer.AsSpan(offset, count));
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (1)
457Span<HttpConnection> usable = stackCopy.AsSpan(0, usableConnections);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (1)
1439ReadOnlySpan<string> headerValues = tmpHeaderValuesArray.AsSpan(0, headerValuesCount);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
732ReadOnlySpan<string> headerValues = _headerValues.AsSpan(0, headerValuesCount);
System.Net.HttpListener (1)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
27DumpBuffer(thisOrContextObject, buffer.AsSpan(offset, count), memberName);
System.Net.Mail (14)
System\Net\Base64Stream.cs (1)
164BaseStream.Write(WriteState.Buffer.AsSpan(0, WriteState.Length));
System\Net\BufferedReadStream.cs (1)
37_storedBuffer.AsSpan(_storedOffset, read).CopyTo(buffer);
System\Net\DelegatedStream.cs (2)
135return ReadInternal(buffer.AsSpan(offset, count)); 194WriteInternal(buffer.AsSpan(offset, count));
System\Net\Mail\SmtpNegotiateAuthenticationModule.cs (1)
126unwrappedChallenge = input.AsSpan(newOffset, newLength);
System\Net\Mail\SmtpReplyReaderFactory.cs (6)
323int actual = ProcessRead(_byteBuffer.AsSpan(start, read), true); 347_bufferedStream.Push(_byteBuffer.AsSpan(start, read - start)); 355_bufferedStream.Push(_byteBuffer.AsSpan(start, read - start)); 457int actual = _parent.ProcessRead(_parent._byteBuffer!.AsSpan(start, _read - start), true); 482_parent._bufferedStream.Push(_parent._byteBuffer!.AsSpan(start, _read - start)); 490_parent._bufferedStream.Push(_parent._byteBuffer!.AsSpan(start, _read - start));
System\Net\Mime\ByteEncoder.cs (1)
80Span<byte> bytes = buffer.AsSpan(0, bytesCount);
System\Net\Mime\EightBitStream.cs (1)
68BaseStream.Write(WriteState.Buffer.AsSpan(0, WriteState.Length));
System\Net\Mime\QEncodedStream.cs (1)
205BaseStream.Write(WriteState.Buffer.AsSpan(0, WriteState.Length));
System.Net.Primitives (5)
System\Net\IPAddress.cs (3)
641return !IsIPv4 && _numbers.AsSpan(0, 6).SequenceEqual((ReadOnlySpan<ushort>)[0, 0, 0, 0, 0, 0xFFFF]); 701ReadOnlySpan<ushort> left = _numbers.AsSpan(0, IPAddressParserStatics.IPv6AddressShorts); 702ReadOnlySpan<ushort> right = comparand._numbers.AsSpan(0, IPAddressParserStatics.IPv6AddressShorts);
System\Net\IPAddressParser.cs (2)
203AppendSections(address.AsSpan(0, 6), destination, ref pos); 215AppendSections(address.AsSpan(0, 8), destination, ref pos);
System.Net.Quic (8)
src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (3)
203_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(newBlockArray); 209_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(_blocks); 212_blocks.AsSpan((int)usedBlocks, (int)unusedInitialBlocks).Clear();
System\Net\Quic\Internal\MsQuicConfiguration.Cache.cs (2)
48bool success = certificate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(0, ThumbprintSize), out _); 57bool success = intermediate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(certCount * ThumbprintSize, ThumbprintSize), out _);
System\Net\Quic\QuicStream.Stream.cs (3)
103return Read(buffer.AsSpan(offset, count)); 127rentedBuffer.AsSpan(0, readLength).CopyTo(buffer); 166Write(buffer.AsSpan(offset, count));
System.Net.Security (14)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs (1)
37Span.CopyTo(destination.AsSpan(offset, sourceLength));
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (2)
56bool success = certContext.TargetCertificate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(0, ThumbprintSize), out _); 62success = intermediate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(certCount * ThumbprintSize, ThumbprintSize), out _);
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
27DumpBuffer(thisOrContextObject, buffer.AsSpan(offset, count), memberName);
src\libraries\Common\src\System\Net\Security\RC4.cs (1)
70CryptographicOperations.ZeroMemory(state.AsSpan(0, 256));
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
31CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
src\libraries\Common\src\System\Text\UrlBase64Encoding.cs (1)
32ReadOnlySpan<char> source = base64.AsSpan(0, base64Len);
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (3)
507info.Slice(0, length + 4).CopyTo(targetInfoBuffer.AsSpan(targetInfoOffset, length + 4)); 531WriteChannelBindingHash(targetInfoBuffer.AsSpan(targetInfoOffset + 4, 16)); 683hmacMic.AppendData(responseBytes.AsSpan(0, payloadOffset));
System\Net\Security\NegotiateStream.cs (3)
401!_context.VerifyIntegrityCheck(_readBuffer.AsSpan(NtlmSignatureLength, readBytes - NtlmSignatureLength), _readBuffer.AsSpan(0, NtlmSignatureLength))) 414statusCode = _context.UnwrapInPlace(_readBuffer.AsSpan(0, readBytes), out _readBufferOffset, out _readBufferCount, out _);
System\Net\Security\SslStreamCertificateContext.Linux.cs (1)
324if (!Interop.Crypto.X509DecodeOcspToExpiration(ret, ocspRequest, subject, issuerHandles.AsSpan(0, _privateIntermediateCertificates.Length + 1), out DateTimeOffset expiration))
System.Net.ServerSentEvents (8)
System\Net\ServerSentEvents\SseParser_1.cs (8)
121_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 201_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 277return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 297_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 317ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 326T data = _itemParser(_eventType ?? SseParser.EventTypeDefault, _dataBuffer.AsSpan(0, _dataLength)); 375ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 526if (_lineBuffer.AsSpan(0, _lineLength).StartsWith(Utf8Bom))
System.Net.Sockets (5)
src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
27DumpBuffer(thisOrContextObject, buffer.AsSpan(offset, count), memberName);
System\Net\Sockets\UDPClient.cs (4)
390return _buffer.AsSpan(0, received).ToArray(); 627byte[] buffer = _buffer.AsSpan(0, result.ReceivedBytes).ToArray(); 653byte[] buffer = _buffer.AsSpan(0, result.ReceivedBytes).ToArray(); 849return _buffer.AsSpan(0, received).ToArray();
System.Net.WebSockets (4)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (1)
68_buffer.AsSpan(0, position).CopyTo(newBuffer);
System\Net\WebSockets\Compression\WebSocketInflater.cs (2)
76_buffer.AsSpan(_position, _available).CopyTo(_buffer); 109_buffer.AsSpan(0, _available).CopyTo(newBuffer);
System\Net\WebSockets\ManagedWebSocket.cs (1)
768RandomNumberGenerator.Fill(buffer.AsSpan(offset, MaskLength));
System.Numerics.Tensors (11)
System\Numerics\Tensors\netcore\TensorOperation.cs (1)
2643Span<T> resultBuffer = rentedBuffer._array.AsSpan(0, rank);
System\Numerics\Tensors\netcore\TensorShape.cs (10)
91destinationLengths = metadata.AsSpan(rank * 0, rank); 92destinationStrides = metadata.AsSpan(rank * 1, rank); 312destinationLengths = metadata.AsSpan(rank * 0, rank); 313destinationStrides = metadata.AsSpan(rank * 1, rank); 363return metadata.AsSpan(rank * 0, rank); 402return metadata.AsSpan(rank * 1, rank); 742lengths = lengthsArray.AsSpan(0, rank); 799intermediateLengths = intermediateLengthsArray.AsSpan(0, rank); 1093intermediateLengths = intermediateLengthsArray.AsSpan(0, rank); 1096intermediateStrides = intermediateStridesArray.AsSpan(0, rank);
System.Private.CoreLib (37)
src\libraries\System.Private.CoreLib\src\System\Buffers\ArrayPool.cs (1)
103array.AsSpan(0, lengthToClear).Clear();
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Utf8.cs (2)
93sourceUtf16 = sourceUtf16Array.AsSpan(0, sourceMaxCharCount); 124prefixUtf16 = prefixUtf16Array.AsSpan(0, prefixMaxCharCount);
src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (1)
526_stream.ReadExactly(buffer.AsSpan(0, numBytes));
src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (1)
238WriteCharsCommonWithoutLengthPrefix(chars.AsSpan(index, count), useThisWriteOverride: false);
src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
723int n = RandomAccess.ReadAtOffset(sfh, bytes.AsSpan(index, count), index); 1246return rentedArray.AsSpan(0, bytesRead).ToArray();
src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (1)
574_buffer.AsSpan(_origin, count).CopyTo(copy);
src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (3)
330_buffer.AsSpan(_readPos, buffer.Length).CopyTo(buffer.Span); 411_buffer.AsSpan(_readPos, bytesFromBuffer).CopyTo(buffer.Span); 448_buffer.AsSpan(0, bytesFromBuffer).CopyTo(buffer.Span);
src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (1)
849_ = ReadAtLeastCore(buffer.AsSpan(offset, count), count, throwOnEndOfStream: true);
src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (6)
810ReadOnlySpan<char> charBufferSpan = _charBuffer.AsSpan(_charPos, _charLen - _charPos); 924int idxOfNewline = charBuffer.AsSpan(charPos, charLen - charPos).IndexOfAny('\r', '\n'); 933retVal = string.Concat(arrayPoolBuffer.AsSpan(0, arrayPoolBufferPos), charBuffer.AsSpan(charPos, idxOfNewline)); 965arrayPoolBuffer.AsSpan(0, arrayPoolBufferPos).CopyTo(newBuffer); 969charBuffer.AsSpan(charPos, charLen - charPos).CopyTo(arrayPoolBuffer.AsSpan(arrayPoolBufferPos));
src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (1)
380WriteSpan(buffer.AsSpan(index, count), appendNewLine: false);
src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (1)
383ReadOnlySpan<byte> source = value.AsSpan(offset, count);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (1)
170seen.AsSpan(0, modulus).Clear();
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (1)
365foreach (string previous in newValues.AsSpan(start, newValuesCount - start))
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (5)
670chunkChars.AsSpan(chunkLength, repeatCount).Fill(value); 699chunkChars.AsSpan(chunkLength, firstLength).Fill(value); 709m_ChunkChars.AsSpan(0, restLength).Fill(value); 2109ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count)); 2234Span<char> span = chunk.m_ChunkChars.AsSpan(curInChunk, endInChunk - curInChunk);
src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (3)
354_readBuffer.AsSpan(_readBufferOffset, bytesToReturn).CopyTo(buffer); 433_readBuffer.AsSpan(_readBufferOffset, bytesToReturn).CopyTo(buffer.Span); 508Span<char> decodedChars = scratchChars.AsSpan(0, charsWritten);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (2)
702return thisRef.AppendFormatted(array.AsSpan(0, charsWritten)); 749return thisRef.AppendFormatted(array.AsSpan(0, charsWritten));
src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.NonAndroid.cs (3)
385int n = RandomAccess.Read(sfh, buffer.AsSpan(index, count), index); 391if (!buffer.AsSpan(index, n).SequenceEqual(rawData.AsSpan(index, n)))
src\System\Reflection\Emit\SignatureHelper.cs (2)
847m_signature.AsSpan(0, m_currSig).SequenceEqual(other.m_signature.AsSpan(0, m_currSig));
System.Private.DataContractSerialization (64)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (2)
212_bytes.AsSpan(_byteOffset, count).CopyTo(buffer); 425_byteCount += _stream.ReadAtLeast(_bytes.AsSpan(_byteOffset + _byteCount, count), count, throwOnEndOfStream: false);
System\Runtime\Serialization\MemoryStreamAdapter.cs (1)
63Span<byte> slicedBuffer = value.Buffer.AsSpan(value.Origin, value.Length - value.Origin);
System\Text\BinHexEncoding.cs (3)
42if (!HexConverter.TryDecodeFromUtf16(chars.AsSpan(charIndex, charCount), bytes.AsSpan(byteIndex, byteCount), out int charsProcessed)) 81HexConverter.EncodeToUtf16(bytes.AsSpan(byteIndex, byteCount), chars.AsSpan(charIndex));
System\Xml\EncodingStreamWrapper.cs (3)
285_byteCount += _stream.ReadAtLeast(_bytes.AsSpan(_byteOffset + _byteCount, count), count, throwOnEndOfStream: false); 362if (!buffer.AsSpan(0, i + 1).EndsWith("encoding"u8)) 620_bytes.AsSpan(_byteOffset, count).CopyTo(buffer);
System\Xml\UniqueId.cs (1)
211ToSpan(chars.AsSpan(offset, count));
System\Xml\ValueHandle.cs (2)
733if (encoding.TryGetChars(bytes.AsSpan(byteOffset, byteCount), chars.AsSpan(charOffset, charCount), out actualCharCount))
System\Xml\XmlBaseReader.cs (1)
1508int newCount = XmlConverter.StripWhitespace(chars.AsSpan(0, charCount));
System\Xml\XmlBaseWriter.cs (1)
765if (!XmlConverter.IsWhitespace(chars.AsSpan(offset, count)))
System\Xml\XmlBinaryReader.cs (11)
1241BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1264BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1287BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1310BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1333BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1356BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1379BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1405foreach (ref DateTime item in array.AsSpan(offset, actual)) 1434BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1440foreach (ref Guid item in array.AsSpan(offset, actual)) 1470foreach (ref TimeSpan item in array.AsSpan(offset, actual))
System\Xml\XmlBinaryWriter.cs (19)
572=> WriteTextImpl(chars.AsSpan(offset, count)); 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)); 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)); 964Span<byte> span = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16); 995Span<byte> bytes = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16); 1300_writer.WriteBoolArray(array.AsSpan(offset, count)); 1318_writer.WriteInt16Array(array.AsSpan(offset, count)); 1336_writer.WriteInt32Array(array.AsSpan(offset, count)); 1354_writer.WriteInt64Array(array.AsSpan(offset, count)); 1372_writer.WriteFloatArray(array.AsSpan(offset, count)); 1390_writer.WriteDoubleArray(array.AsSpan(offset, count)); 1408_writer.WriteDecimalArray(array.AsSpan(offset, count)); 1426_writer.WriteDateTimeArray(array.AsSpan(offset, count)); 1444_writer.WriteGuidArray(array.AsSpan(offset, count)); 1462_writer.WriteTimeSpanArray(array.AsSpan(offset, count));
System\Xml\XmlBufferReader.cs (12)
236int read = _stream.ReadAtLeast(_buffer.AsSpan(_offsetMax, needed), needed, throwOnEndOfStream: false); 377float f = BinaryPrimitives.ReadSingleLittleEndian(GetBuffer(sizeof(float), out int offset).AsSpan(offset, sizeof(float))); 384double d = BinaryPrimitives.ReadDoubleLittleEndian(GetBuffer(sizeof(double), out int offset).AsSpan(offset, sizeof(double))); 398ReadOnlySpan<byte> bytes = buffer.AsSpan(offset, sizeof(decimal)); 496.AsSpan(_offset, dst.Length) 784return XmlConverter.IsWhitespace(_buffer.AsSpan(offset, length)); 941.AsSpan(offset, sizeof(T)); 949=> MemoryMarshal.Read<T>(_buffer.AsSpan(offset, sizeof(T))); 964=> BinaryPrimitives.ReadSingleLittleEndian(_buffer.AsSpan(offset, sizeof(float))); 967=> BinaryPrimitives.ReadDoubleLittleEndian(_buffer.AsSpan(offset, sizeof(double))); 977ReadOnlySpan<byte> bytes = _buffer.AsSpan(offset, sizeof(decimal)); 994=> new Guid(_buffer.AsSpan(offset, ValueHandleLength.Guid));
System\Xml\XmlStreamNodeWriter.cs (1)
232var buffer = GetBuffer(bytes.Length, out int offset).AsSpan(offset, bytes.Length);
System\Xml\XmlUTF8TextWriter.cs (7)
364WriteUTF8Bytes(prefixBuffer.AsSpan(prefixOffset, prefixLength)); 375WriteUTF8Bytes(localNameBuffer.AsSpan(localNameOffset, localNameLength)); 434WriteUTF8Bytes(chars.AsSpan(offset + i, j - i)); 447WriteUTF8Bytes(chars.AsSpan(offset + i, j - i)); 453WriteUTF8Bytes(chars.AsSpan(offset + i, count - i)); 463WriteUTF8Bytes(chars.AsSpan(offset, count)); 521WriteUTF8Bytes(chars.AsSpan(offset, maxEntityLength - offset));
System.Private.Uri (5)
System\Uri.cs (4)
1043Span<char> slashSpan = result.AsSpan(0, count); 4546destLength = start + Compress(dest.AsSpan(start, destLength - start), syntax); 4866return string.Concat(path.AsSpan(1, length - 1), extra); 4884return string.Concat(left, path.AsSpan(0, length), extra);
System\UriHelper.cs (1)
319vsb.Append(dest.AsSpan(0, destPosition));
System.Private.Xml (20)
System\Xml\Base64Decoder.cs (3)
53Decode(chars.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), out int charsDecoded, out int bytesDecoded); 72Decode(str.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), out int charsDecoded, out int bytesDecoded);
System\Xml\BinaryXml\XmlBinaryReader.cs (2)
2334ReadOnlySpan<byte> srcBytes = state._data.AsSpan(state.pos, checked(cch * sizeof(char))); 3490ReadOnlySpan<byte> data = _data.AsSpan(_tokDataPos, _pos - _tokDataPos);
System\Xml\BinHexDecoder.cs (3)
53Decode(chars.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), 74Decode(str.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex),
System\Xml\BinHexEncoder.cs (1)
23HexConverter.EncodeToUtf16(buffer.AsSpan(index, cnt), chars);
System\Xml\BinHexEncoderAsync.cs (1)
26HexConverter.EncodeToUtf16(buffer.AsSpan(index, cnt), chars);
System\Xml\Core\XmlTextReaderImpl.cs (4)
3197if (_ps.bytes.AsSpan(0, _ps.bytesUsed).StartsWith(preamble)) 3692switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 3810switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos)) 9566AdjustLineInfo(chars.AsSpan(startPos, endPos - startPos), isNormalized, ref lineInfo);
System\Xml\Core\XmlTextReaderImplAsync.cs (2)
1276switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 1390switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos))
System\Xml\NameTable.cs (4)
99int hashCode = string.GetHashCode(key.AsSpan(start, len)); 103if (e.hashCode == hashCode && e.str.AsSpan().SequenceEqual(key.AsSpan(start, len))) 159int hashCode = string.GetHashCode(key.AsSpan(start, len)); 163if (e.hashCode == hashCode && e.str.AsSpan().SequenceEqual(key.AsSpan(start, len)))
System.Reflection.Metadata (10)
System\Reflection\Metadata\BlobBuilder.cs (4)
53private Span<byte> Span => _buffer.AsSpan(0, Length); 237if (!left._buffer.AsSpan(leftStart, minLength).SequenceEqual(right._buffer.AsSpan(rightStart, minLength))) 789WriteBytes(buffer.AsSpan(start, byteCount));
System\Reflection\Metadata\BlobWriter.cs (6)
57return Length == other.Length && _buffer.AsSpan(_start, Length).SequenceEqual(other._buffer.AsSpan(other._start, other.Length)); 91return _buffer.AsSpan(_start + start, byteCount).ToArray(); 104return ImmutableArray.Create(_buffer.AsSpan(_start + start, byteCount)); 130_buffer.AsSpan(start, byteCount).Fill(value); 234WriteBytes(buffer.AsSpan(start, byteCount));
System.Runtime.Numerics (4)
System\Number.BigInteger.cs (1)
246Span<uint> wholeBlockDestination = bits.AsSpan(0, wholeBlockCount);
System\Numerics\BigInteger.cs (3)
375Span<byte> uintBytes = MemoryMarshal.AsBytes(val.AsSpan(0, wholeUInt32Count)); 394BinaryPrimitives.ReverseEndianness(val.AsSpan(0, wholeUInt32Count), val); 650return BitOperations.IsPow2(_bits[iu]) && !_bits.AsSpan(0, iu).ContainsAnyExcept(0u);
System.Security.Cryptography (65)
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
31CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
src\libraries\Common\src\System\Security\Cryptography\KeyBlobHelpers.cs (1)
60target.AsSpan(0, length - bytesWritten).Clear();
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
221encryptedSpan = encryptedRent.AsSpan(0, written);
src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (3)
1198Span<byte> keySpan = rented.AsSpan(0, Algorithm.PublicKeySizeInBytes); 1244tmp.WriteEncodedValueForCrypto(rented.AsSpan(0, written)); 1275tmp.WriteEncodedValueForCrypto(rented.AsSpan(0, written));
src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (3)
1724Span<byte> buffer = rent.AsSpan(0, decapsulationKeySize); 1801tmp.WriteEncodedValueForCrypto(rented.AsSpan(0, written)); 1835TResult result = func(buffer.AsSpan(0, written));
src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.cs (2)
28Span<byte> buffer = rented.AsSpan(0, size); 35Span<byte> buffer = rented.AsSpan(0, size);
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (3)
188buf = rented.AsSpan(0, byteCount); 473buf = rented.AsSpan(0, byteCount); 951rentedDestination.AsSpan(0, writeOffset).CopyTo(destination);
src\libraries\Common\src\System\Security\Cryptography\PemKeyHelpers.Factory.cs (2)
85Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten); 150Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten);
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (2)
188authSafeSpan = rentedAuthSafe.AsSpan(0, written); 193macSpan = rentedMac.AsSpan(0, macKey.Length);
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (2)
256CryptographicOperations.ZeroMemory(destination.AsSpan(0, written)); 390encryptedSpan = encryptedRent.AsSpan(0, written);
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
155I = IRented.AsSpan(0, ILen);
src\libraries\Common\src\System\Security\Cryptography\RSAKeyFormatHelper.cs (1)
199AsnWriter ret = WriteSubjectPublicKeyInfo(rented.AsSpan(0, written));
src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (1)
1712return func(buffer.AsSpan(0, written));
src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.cs (1)
653stream.ReadExactly(rented.AsSpan(read, totalLength - read));
src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (2)
694_decryptBuffer.AsSpan(saveOffset, written), 721_decryptBuffer.AsSpan(saveOffset, _decryptBufferOffset - saveOffset));
src\libraries\Common\src\System\Text\UrlBase64Encoding.cs (1)
32ReadOnlySpan<char> source = base64.AsSpan(0, base64Len);
System\Security\Cryptography\Base64Transforms.cs (4)
49Span<byte> output = outputBuffer.AsSpan(outputOffset, requiredOutputLength); 151ReadOnlySpan<byte> inputBufferSpan = inputBuffer.AsSpan(inputOffset, inputCount); 195ReadOnlySpan<byte> inputBufferSpan = inputBuffer.AsSpan(inputOffset, inputCount); 239_inputBuffer.AsSpan(0, index).CopyTo(transformBuffer);
System\Security\Cryptography\CryptoStream.cs (6)
322CryptographicOperations.ZeroMemory(_outputBuffer.AsSpan(_outputBufferIndex, bytesToCopy)); 392tempOutputBuffer.AsSpan(0, numOutputBytes).CopyTo(buffer.Span); 520CryptographicOperations.ZeroMemory(sharedBuffer.AsSpan(0, buffer.Length)); 673CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, inputBuffer.Length)); 705CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, bufferSize)); 736CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, bufferSize));
System\Security\Cryptography\ECDsa.cs (2)
170CryptographicOperations.ZeroMemory(rented.AsSpan(0, bytesWritten)); 452CryptographicOperations.ZeroMemory(rented.AsSpan(0, bytesWritten));
System\Security\Cryptography\HashAlgorithm.cs (2)
112CryptographicOperations.ZeroMemory(buffer.AsSpan(0, clearLimit)); 148CryptographicOperations.ZeroMemory(rented.AsSpan(0, clearLimit));
System\Security\Cryptography\LiteHashProvider.cs (2)
126hash.Append(rented.AsSpan(0, read)); 157hash.Append(rented.AsSpan(0, read));
System\Security\Cryptography\LiteHashProvider.Xof.cs (1)
142hash.Append(rented.AsSpan(0, read));
System\Security\Cryptography\OpenSslCipherLite.cs (1)
75rented.AsSpan(0, written).CopyTo(output);
System\Security\Cryptography\PemKeyHelpers.cs (2)
151Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten); 237Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten);
System\Security\Cryptography\Rfc2898DeriveBytes.cs (2)
86RandomNumberGenerator.Fill(_salt.AsSpan(0, saltSize)); 144return _salt.AsSpan(0, _salt.Length - sizeof(uint)).ToArray();
System\Security\Cryptography\RSA.cs (3)
748AsnWriter writer = RSAKeyFormatHelper.WriteSubjectPublicKeyInfo(rented.AsSpan(0, pkcs1Size)); 1461rentResult = rented.AsSpan(0, written).ToArray(); 1464CryptographicOperations.ZeroMemory(rented.AsSpan(0, written));
System\Security\Cryptography\SymmetricAlgorithm.cs (1)
773Span<byte> decryptBuffer = decryptRent.AsSpan(0, ciphertext.Length);
System\Security\Cryptography\UniversalCryptoDecryptor.cs (5)
90ciphertext = rentedCiphertext.AsSpan(0, inputBuffer.Length); 97ciphertext = rentedCiphertext.AsSpan(0, rentedCiphertextSize); 144written = UncheckedTransformFinalBlock(inputBuffer.AsSpan(inputOffset, inputCount), rented); 145return rented.AsSpan(0, written).ToArray(); 156int written = UncheckedTransformFinalBlock(inputBuffer.AsSpan(inputOffset, inputCount), buffer);
System\Security\Cryptography\UniversalCryptoEncryptor.cs (1)
51int written = UncheckedTransformFinalBlock(inputBuffer.AsSpan(inputOffset, inputCount), buffer);
System\Security\Cryptography\UniversalCryptoOneShot.cs (1)
168Span<byte> buffer = rentedBuffer.AsSpan(0, input.Length);
System\Security\Cryptography\UniversalCryptoTransform.cs (1)
114return UncheckedTransformBlock(inputBuffer.AsSpan(inputOffset, inputCount), outputBuffer.AsSpan(outputOffset));
System\Security\Cryptography\X509Certificates\CertificateRequest.Load.cs (1)
65rented.AsSpan(0, bytesWritten),
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Load.cs (1)
281rented.AsSpan(0, bytesWritten),
System\Security\Cryptography\X509Certificates\OpenSslX509ChainProcessor.cs (1)
291tempChain = MemoryMarshal.Cast<byte, IntPtr>(tempChainRent.AsSpan(0, targetSize));
System\Security\Cryptography\XmlKeyHelper.cs (1)
64ret.AsSpan(0, shift).Clear();
System.Security.Cryptography.Cose (2)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
849byte[] encodedSignProtected = buffer.AsSpan(0, bytesWritten).ToArray(); 856byte[] signature = buffer.AsSpan(0, bytesWritten).ToArray();
System.Security.Cryptography.Pkcs (12)
Internal\Cryptography\Pal\AnyOS\ManagedPal.Encrypt.cs (1)
190ReadOnlySpan<byte> content = contentInfo.Content.AsSpan(contentOffset, contentLength);
src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
31CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
221encryptedSpan = encryptedRent.AsSpan(0, written);
src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (3)
188buf = rented.AsSpan(0, byteCount); 473buf = rented.AsSpan(0, byteCount); 951rentedDestination.AsSpan(0, writeOffset).CopyTo(destination);
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (2)
188authSafeSpan = rentedAuthSafe.AsSpan(0, written); 193macSpan = rentedMac.AsSpan(0, macKey.Length);
src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (2)
256CryptographicOperations.ZeroMemory(destination.AsSpan(0, written)); 390encryptedSpan = encryptedRent.AsSpan(0, written);
src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
155I = IRented.AsSpan(0, ILen);
System\Security\Cryptography\Pkcs\SignedCms.cs (1)
274return rented.AsSpan(0, bytesWritten).ToArray();
System.Security.Cryptography.Xml (1)
System\Security\Cryptography\Xml\SignedXml.cs (1)
1065return m_signature.SignatureValue.AsSpan().SequenceEqual(hashValue.AsSpan(0, m_signature.SignatureValue.Length));
System.Text.Encodings.Web (2)
System\Text\Encodings\Web\TextEncoder.cs (2)
252int indexOfFirstCharToEncode = FindFirstCharacterToEncode(value.AsSpan(startIndex, characterCount)); 261EncodeCore(output, value.AsSpan(startIndex + indexOfFirstCharToEncode, characterCount - indexOfFirstCharToEncode));
System.Text.Json (17)
System\Text\Json\Document\JsonDocument.cs (1)
80extraRentedBytes.AsSpan(0, length).Clear();
System\Text\Json\Document\JsonDocument.MetadataDb.cs (3)
180_data = _data.AsSpan(0, Length).ToArray(); 315Span<byte> data = _data.AsSpan(0, Length); 382_data.AsSpan(startIndex, length).CopyTo(newDatabase);
System\Text\Json\Document\JsonDocument.Parse.cs (8)
97utf8Bytes.AsSpan(0, length).Clear(); 279utf8Bytes.AsSpan(0, expectedByteCount).Clear(); 303utf8Bytes.AsSpan(0, expectedByteCount).Clear(); 619Span<byte> rentedSpan = rented.AsSpan(0, length); 791utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length))) 818rented.AsSpan(0, written).Clear(); 871JsonConstants.Utf8Bom.SequenceEqual(rented.AsSpan(0, utf8BomLength))) 900rented.AsSpan(0, written).Clear();
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (2)
83utf8Name = tmpUtf8.AsSpan(0, len); 206rented.AsSpan(0, written).Clear();
System\Text\Json\JsonHelpers.Escaping.cs (1)
90utf8Value.CopyTo(propertySection.AsSpan(1, length));
System\Text\Json\Serialization\ReadBufferState.cs (2)
54public readonly ReadOnlySpan<byte> Bytes => _buffer.AsSpan(_offset, _count); 170if (_buffer.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom))
System.Text.RegularExpressions (5)
System\Text\RegularExpressions\Symbolic\MintermClassifier.cs (2)
54Span<object> charRangesPerMinterm = arrayPoolArray.AsSpan(0, minterms.Length); 88lookup.AsSpan((int)start, (int)(end + 1 - start)).Fill(T.CreateTruncating(mintermId));
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Automata.cs (2)
137return _dfaDelta.AsSpan(state.Id << _mintermsLog, numMinterms); 156return _nfaDelta.AsSpan(nfaState << _mintermsLog, numMinterms);
System\Text\StructListBuilder.cs (1)
27public Span<T> AsSpan() => _array.AsSpan(0, _count);
System.Transactions.Local (2)
System\Transactions\TransactionInteropNonWindows.cs (2)
93var txId = new Guid(cookie.AsSpan(16, 16)); 159var txId = new Guid(propagationToken.AsSpan(8, 16));
System.Web.HttpUtility (4)
System\Web\Util\HttpEncoder.cs (4)
204return UrlDecode(bytes.AsSpan(offset, count)); 397return UrlEncode(bytes.AsSpan(offset, count)); 573foreach (byte b in bytes.AsSpan(0, utf8Length)) 590chars.AsSpan(0, charCount),
System.Windows.Forms (1)
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\MultiSelectRootGridEntry.PropertyMerger.cs (1)
52List<PropertyDescriptor[]>? firstProperties = GetCommonProperties(objects.AsSpan(0, 1), presort: false, tab, parentEntry);
System.Windows.Forms.Design (2)
System\ComponentModel\Design\ByteViewer.cs (2)
262return _dataBuf.AsSpan(offset, length); 343Encoding.Unicode.GetChars(_dataBuf.AsSpan(i, 2), new Span<char>(ref unicodeChar));
System.Xaml (3)
src\Microsoft.DotNet.Wpf\src\Shared\MS\Utility\FrugalList.cs (3)
1352_entries.AsSpan(0, _count).Clear(); 1503public override T[] ToArray() => _entries.AsSpan(0, _count).ToArray(); 1505public override void CopyTo(T[] array, int index) => _entries.AsSpan(0, _count).CopyTo(array.AsSpan(index));