10411 references to Length
aspire (34)
Aspire.Cli.Tests (1)
Aspire.Dashboard (12)
Aspire.Hosting (3)
Aspire.Hosting.Docker (14)
BuildActionTelemetryTable (3)
CodeGenerator (1)
ConfigurationSchemaGenerator (2)
dotnet-dev-certs (22)
EventSourceGenerator (2)
GenerateDocumentationAndConfigFiles (48)
http2cat (27)
IIS.FunctionalTests (27)
IIS.LongTests (27)
IIS.NewHandler.FunctionalTests (27)
IIS.ShadowCopy.Tests (8)
IISExpress.FunctionalTests (27)
illink (25)
ILLink.RoslynAnalyzer (36)
InMemory.FunctionalTests (2)
Interop.FunctionalTests (1)
KeyManagementSimulator (2)
Metrics (49)
Metrics.Legacy (49)
Microsoft.AspNetCore.Antiforgery (6)
Microsoft.AspNetCore.Authentication.Negotiate (5)
Microsoft.AspNetCore.Authorization (2)
Microsoft.AspNetCore.Components (23)
Microsoft.AspNetCore.Components.Endpoints (5)
Microsoft.AspNetCore.Components.Forms (2)
Microsoft.AspNetCore.Components.Server (30)
Microsoft.AspNetCore.Components.Web (6)
Microsoft.AspNetCore.Components.WebView (2)
Microsoft.AspNetCore.CookiePolicy (1)
Microsoft.AspNetCore.Cors (2)
Microsoft.AspNetCore.Cryptography.Internal (2)
Microsoft.AspNetCore.DataProtection (34)
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (4)
Microsoft.AspNetCore.DataProtection.Tests (5)
Microsoft.AspNetCore.DeveloperCertificates.XPlat (22)
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (1)
Microsoft.AspNetCore.Http (2)
Microsoft.AspNetCore.Http.Abstractions (7)
Microsoft.AspNetCore.Http.Connections (4)
Microsoft.AspNetCore.Http.Connections.Common (1)
Microsoft.AspNetCore.Http.Extensions (11)
Microsoft.AspNetCore.Http.Results (1)
Microsoft.AspNetCore.HttpLogging (6)
Microsoft.AspNetCore.HttpOverrides (1)
Microsoft.AspNetCore.Identity (5)
Microsoft.AspNetCore.Identity.FunctionalTests (2)
Microsoft.AspNetCore.Mvc.Core (3)
Microsoft.AspNetCore.Mvc.ViewFeatures (1)
Microsoft.AspNetCore.OpenApi (5)
Microsoft.AspNetCore.OutputCaching (8)
Microsoft.AspNetCore.OutputCaching.Microbenchmarks (2)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Routing (23)
Microsoft.AspNetCore.Server.HttpSys (19)
Windows.Win32.PInvoke.HTTPAPI.dll.g.cs (4)
667 uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, BytesSentLocal, default, default, Overlapped, LogData.HasValue ? &LogDataLocal : null);
697 uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, default(uint* ), default, default, Overlapped, LogData.HasValue ? &LogDataLocal : null);
770 uint __result = PInvoke.HttpSetRequestQueueProperty(RequestQueueHandleLocal, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length, default, default);
816 uint __result = PInvoke.HttpSetUrlGroupProperty(UrlGroupId, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (26)
Microsoft.AspNetCore.Server.IIS (16)
Microsoft.AspNetCore.Server.Kestrel.Core (155)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Microsoft.AspNetCore.Shared.Tests (111)
Windows.Win32.PInvoke.HTTPAPI.dll.g.cs (13)
191 uint __result = PInvoke.HttpSetRequestQueueProperty(RequestQueueHandleLocal, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length, default, default);
337 uint __result = PInvoke.HttpSetRequestProperty(RequestQueueHandleLocal, Id, PropertyId, (void* )InputLocal, (uint )Input.Length, OverlappedLocal);
394 uint __result = PInvoke.HttpQueryRequestProperty(RequestQueueHandleLocal, Id, PropertyId, (void* )QualifierLocal, (uint )Qualifier.Length, (void* )OutputLocal, (uint )Output.Length, BytesReturnedLocal, Overlapped);
425 uint __result = PInvoke.HttpQueryRequestProperty(RequestQueueHandleLocal, Id, PropertyId, (void* )QualifierLocal, (uint )Qualifier.Length, (void* )OutputLocal, (uint )Output.Length, default(uint* ), Overlapped);
702 uint __result = PInvoke.HttpSetServerSessionProperty(ServerSessionId, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length);
939 uint __result = PInvoke.HttpSetUrlGroupProperty(UrlGroupId, Property, (void* )PropertyInformationLocal, (uint )PropertyInformation.Length);
1389 uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, BytesSentLocal, default, default, Overlapped, LogData.HasValue ? &LogDataLocal : null);
1419 uint __result = PInvoke.HttpSendResponseEntityBody(RequestQueueHandleLocal, RequestId, Flags, (ushort )EntityChunks.Length, EntityChunksLocal, default(uint* ), default, default, Overlapped, LogData.HasValue ? &LogDataLocal : null);
2056 uint __result = PInvoke.HttpSetServiceConfiguration(default, ConfigId, (void* )pConfigInformationLocal, (uint )pConfigInformation.Length, default);
2086 uint __result = PInvoke.HttpUpdateServiceConfiguration(default, ConfigId, (void* )ConfigInfoLocal, (uint )ConfigInfo.Length, default);
2116 uint __result = PInvoke.HttpDeleteServiceConfiguration(default, ConfigId, (void* )pConfigInformationLocal, (uint )pConfigInformation.Length, default);
2156 uint __result = PInvoke.HttpQueryServiceConfiguration(default, ConfigId, (void* )pInputLocal, (uint )pInput.Length, (void* )pOutputLocal, (uint )pOutput.Length, pReturnLengthLocal, default);
2171 uint __result = PInvoke.HttpQueryServiceConfiguration(default, ConfigId, (void* )pInputLocal, (uint )pInput.Length, (void* )pOutputLocal, (uint )pOutput.Length, default(uint* ), default);
Microsoft.AspNetCore.SignalR.Client.Tests (4)
Microsoft.AspNetCore.SignalR.Common (5)
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (4)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (5)
Microsoft.AspNetCore.SignalR.Specification.Tests (4)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (4)
Microsoft.AspNetCore.WebSockets (6)
Microsoft.AspNetCore.WebUtilities (29)
Microsoft.Build (29)
Microsoft.Build.Framework (1)
Microsoft.Build.Tasks.CodeAnalysis (6)
Microsoft.Build.Tasks.CodeAnalysis.Sdk (6)
Microsoft.Build.Tasks.Core (1)
Microsoft.Build.Utilities.Core (4)
Microsoft.CodeAnalysis (85)
Microsoft.CodeAnalysis.Analyzers (49)
Microsoft.CodeAnalysis.AnalyzerUtilities (49)
Microsoft.CodeAnalysis.BannedApiAnalyzers (49)
Microsoft.CodeAnalysis.CodeStyle (52)
Microsoft.CodeAnalysis.Collections.Package (1)
Microsoft.CodeAnalysis.CSharp (24)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Features (4)
Microsoft.CodeAnalysis.CSharp.Workspaces (1)
Microsoft.CodeAnalysis.EditorFeatures (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (2)
Microsoft.CodeAnalysis.ExpressionEvaluator.ResultProvider (7)
Microsoft.CodeAnalysis.Extensions.Package (4)
Microsoft.CodeAnalysis.Features (13)
Microsoft.CodeAnalysis.Features.Test.Utilities (2)
Microsoft.CodeAnalysis.InteractiveHost (8)
Microsoft.CodeAnalysis.LanguageServer.Protocol (1)
Microsoft.CodeAnalysis.PerformanceSensitiveAnalyzers (49)
Microsoft.CodeAnalysis.PublicApiAnalyzers (49)
Microsoft.CodeAnalysis.ResxSourceGenerator (49)
Microsoft.CodeAnalysis.Test.Utilities (8)
Microsoft.CodeAnalysis.Threading.Package (1)
Microsoft.CodeAnalysis.Workspaces (70)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (25)
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
Microsoft.CSharp (1)
Microsoft.Data.Analysis (168)
Microsoft.Data.Analysis.Tests (4)
Microsoft.DotNet.StrongName (3)
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (8)
Microsoft.Extensions.AI (7)
Microsoft.Extensions.AI.Abstractions (3)
Microsoft.Extensions.AI.Evaluation.NLP (6)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Integration.Tests (3)
Microsoft.Extensions.Caching.Hybrid (3)
Microsoft.Extensions.Compliance.Abstractions (4)
Microsoft.Extensions.Compliance.Abstractions.Tests (2)
Microsoft.Extensions.Compliance.Redaction.Tests (2)
Microsoft.Extensions.DataIngestion (7)
Microsoft.Extensions.DependencyModel (6)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (26)
Microsoft.Extensions.Http.Diagnostics (12)
Microsoft.Extensions.Identity.Core (2)
Microsoft.Extensions.Logging.Abstractions (3)
Microsoft.Extensions.Logging.Console (4)
Microsoft.Extensions.Logging.Generators (11)
Microsoft.Extensions.Options.SourceGeneration (2)
Microsoft.Extensions.Primitives (2)
Microsoft.Extensions.ServiceDiscovery.Dns (3)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (5)
Microsoft.Extensions.Telemetry (19)
Microsoft.Extensions.Telemetry.Abstractions.Tests (12)
Microsoft.Extensions.Telemetry.Tests (7)
Microsoft.Interop.ComInterfaceGenerator (4)
Microsoft.Interop.LibraryImportGenerator (2)
Microsoft.Interop.LibraryImportGenerator.Downlevel (2)
Microsoft.Interop.SourceGeneration (2)
Microsoft.JSInterop (2)
Microsoft.Maui (1)
Microsoft.Maui.Essentials (2)
Microsoft.Maui.Graphics (14)
Microsoft.ML.Core (183)
Microsoft.ML.Core.Tests (39)
UnitTests\TestVBuffer.cs (34)
38Assert.Equal(4, buffer.GetValues().Length);
101float infNorm = a.GetValues().Length == 0 ? 0 : a.Items().Max(iv => Math.Abs(iv.Value));
471List<int> indices = new List<int>(a.GetIndices().Length);
472TDst[] values = new TDst[a.GetValues().Length];
546if (a.GetValues().Length == 0 || c == 0)
554var editor = VBufferEditor.Create(ref aa, b.Length, aa.GetValues().Length, requireIndicesOnDense: true);
908while (index < a.GetValues().Length)
928Assert.True(expectedIndices.Count <= a.GetValues().Length);
1014var editor = VBufferEditor.Create(ref dst, src.Length, src.GetValues().Length);
1030Assert.Equal(expected.GetValues().Length, actual.GetValues().Length);
1034for (int i = 0; i < expected.GetIndices().Length; ++i)
1037for (int i = 0; i < expected.GetValues().Length; ++i)
1118GenerateVBuffer(rgen, len, a.GetValues().Length, out b);
1120for (int i = 0; i < a.GetIndices().Length; ++i)
1127GenerateVBuffer(rgen, a.GetValues().Length, rgen.Next(a.GetValues().Length), out b);
1128bEditor = VBufferEditor.Create(ref b, len, b.GetValues().Length);
1141int boundary = rgen.Next(a.GetValues().Length + 1);
1142GenerateVBuffer(rgen, len, a.GetValues().Length - boundary, out b);
1143if (a.GetValues().Length != 0 && b.GetValues().Length != 0 && a.GetValues().Length != b.GetValues().Length)
1189int j = actual.GetValues().Length == 0 ? length : actual.GetIndices()[jj];
1195j = ++jj == actual.GetValues().Length ? length : actual.GetIndices()[jj];
1205int i = expected.GetValues().Length == 0 ? length : expected.GetIndices()[ii];
1211i = ++ii == expected.GetValues().Length ? length : expected.GetIndices()[ii];
1222int i = expected.GetValues().Length == 0 ? length : expected.GetIndices()[ii];
1223int j = actual.GetValues().Length == 0 ? length : actual.GetIndices()[jj];
1231i = ++ii == expected.GetValues().Length ? length : expected.GetIndices()[ii];
1232j = ++jj == actual.GetValues().Length ? length : actual.GetIndices()[jj];
1237i = ++ii == expected.GetValues().Length ? length : expected.GetIndices()[ii];
1243j = ++jj == actual.GetValues().Length ? length : actual.GetIndices()[jj];
Microsoft.ML.CpuMath (85)
Microsoft.ML.Data (229)
Deprecated\Vector\VBufferMathUtils.cs (39)
22if (aValues.Length == 0)
51if (aValues.Length == 0)
63if (aValues.Length == 0)
74if (aValues.Length == 0)
86if (c == 1 || dst.GetValues().Length == 0)
104int count = srcValues.Length;
144if (srcValues.Length == 0)
153CpuMathUtils.Add(srcValues, src.GetIndices(), editor.Values, srcValues.Length);
172if (srcValues.Length == 0 || c == 0)
181CpuMathUtils.AddScale(c, srcValues, src.GetIndices(), editor.Values, srcValues.Length);
198if (srcValues.Length == 0 || c == 0)
226if (c == 0 || b.GetValues().Length == 0)
228else if (a.GetValues().Length == 0)
246if (srcValues.Length == 0 || c == 0)
256CpuMathUtils.AddScale(c, srcValues, values, srcValues.Length);
258CpuMathUtils.AddScale(c, srcValues, src.GetIndices(), values, srcValues.Length);
268int dMin = dstIndices.Length == 0 ? 0 : dstIndices.FindIndexSorted(0, dstIndices.Length, offset);
269int dLim = dstIndices.Length == 0 ? 0 : dstIndices.FindIndexSorted(dMin, dstIndices.Length, offset + src.Length);
277gapCount = srcValues.Length;
279for (int iS = 0, iD = dMin; iS < srcIndices.Length && iD < dLim;)
298dstValues.Length + gapCount,
306if (dstValues.Length != dLim)
308Contracts.Assert(dLim < dstValues.Length);
309indices.Slice(dLim, dstValues.Length - dLim)
311values.Slice(dLim, dstValues.Length - dLim)
340int iS = srcIndices.Length - 1;
387else if (src.GetValues().Length == 0 || c == 0)
413if (srcValues.Length == 0)
418Contracts.Assert(-1 <= ind && ind < srcValues.Length);
437while (ind < srcIndices.Length && srcIndices[ind] == ind)
439Contracts.Assert(ind <= srcIndices.Length);
440Contracts.Assert(ind == srcIndices.Length || ind < srcIndices[ind]);
449if (srcValues.Length == 0)
454Contracts.Assert(-1 <= ind && ind < srcValues.Length);
473while (ind < srcIndices.Length && srcIndices[ind] == ind)
475Contracts.Assert(ind <= srcIndices.Length);
476Contracts.Assert(ind == srcIndices.Length || ind < srcIndices[ind]);
Deprecated\Vector\VectorUtils.cs (36)
34if (bValues.Length == 0)
38return CpuMathUtils.DotProductSparse(a, bValues, b.GetIndices(), bValues.Length);
47if (aValues.Length == 0 || bValues.Length == 0)
54return CpuMathUtils.DotProductSparse(aValues, bValues, b.GetIndices(), bValues.Length);
58return CpuMathUtils.DotProductSparse(bValues, aValues, a.GetIndices(), aValues.Length);
59return DotProductSparse(aValues, a.GetIndices(), 0, aValues.Length, bValues, b.GetIndices(), 0, bValues.Length);
83for (int i = 0; i < aValues.Length; i++)
175Contracts.Assert(valuesA.Length == indicesA.Length);
176Contracts.Assert(valuesB.Length == indicesB.Length);
182while (ia < indicesA.Length && ib < indicesB.Length)
205while (ia < indicesA.Length)
212while (ib < indicesB.Length)
225if (valuesB.Length == 0)
228var dotP = CpuMathUtils.DotProductSparse(valuesA, valuesB, indicesB, valuesB.Length);
235Contracts.Assert(0 <= length && length <= valuesA.Length);
236Contracts.Assert(0 <= length && length <= valuesB.Length);
258if (aValues.Length == 0 || bValues.Length == 0)
264return CpuMathUtils.DotProductSparse(aValues.Slice(offset), bValues, b.GetIndices(), bValues.Length);
270int aMin = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset);
271int aLim = Utils.FindIndexSorted(aIndices, 0, aIndices.Length, offset + b.Length);
279for (int iA = aMin, iB = 0; iA < aLim && iB < bIndices.Length;)
309if (bValues.Length == 0)
314return CpuMathUtils.DotProductSparse(a.AsSpan(offset), bValues, b.GetIndices(), bValues.Length);
323Contracts.Assert(0 <= ia && ia < iaLim && iaLim <= aIndices.Length);
324Contracts.Assert(0 <= ib && ib < ibLim && ibLim <= bIndices.Length);
447if (srcValues.Length == 0 || c == 0)
451CpuMathUtils.AddScale(c, srcValues, dst, srcValues.Length);
455for (int i = 0; i < srcValues.Length; i++)
475if (srcValues.Length == 0 || c == 0)
486for (int i = 0; i < srcValues.Length; i++)
Microsoft.ML.DataView (5)
Microsoft.ML.Ensemble (3)
Microsoft.ML.EntryPoints (1)
Microsoft.ML.FastTree (24)
Microsoft.ML.ImageAnalytics (2)
Microsoft.ML.KMeansClustering (3)
Microsoft.ML.LightGbm (5)
Microsoft.ML.Mkl.Components (10)
Microsoft.ML.OneDal (2)
Microsoft.ML.OnnxTransformer (2)
Microsoft.ML.PCA (1)
Microsoft.ML.Predictor.Tests (1)
Microsoft.ML.Samples (3)
Microsoft.ML.StandardTrainers (37)
Standard\SdcaBinary.cs (3)
880CpuMathUtils.SdcaL1UpdateDense(primalUpdate, featureValues.Length, featureValues, l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
881else if (featureValues.Length > 0)
882CpuMathUtils.SdcaL1UpdateSparse(primalUpdate, featureValues.Length, featureValues, features.GetIndices(), l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
Standard\SdcaMulticlass.cs (6)
298CpuMathUtils.SdcaL1UpdateDense(-primalUpdate, featureValues.Length, featureValues, l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
299else if (featureValues.Length > 0)
300CpuMathUtils.SdcaL1UpdateSparse(-primalUpdate, featureValues.Length, featureValues, features.GetIndices(), l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
329CpuMathUtils.SdcaL1UpdateDense(labelPrimalUpdate, featureValues.Length, featureValues, l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
330else if (featureValues.Length > 0)
331CpuMathUtils.SdcaL1UpdateSparse(labelPrimalUpdate, featureValues.Length, featureValues, features.GetIndices(), l1Threshold, l1IntermediateWeightsEditor.Values, weightsEditor.Values);
Microsoft.ML.TensorFlow.Tests (16)
TensorflowTests.cs (16)
321Assert.Equal(sample.OneDim.Length, oneDimValues.Length);
325Assert.Equal(sample.TwoDim.Length, twoDimValues.Length);
329Assert.Equal(sample.ThreeDim.Length, threeDimValues.Length);
333Assert.Equal(sample.FourDim.Length, fourDimValues.Length);
337Assert.Equal(sample.FourDimKnown.Length, fourDimKnownValues.Length);
462Assert.Equal(2, f64Values.Length);
465Assert.Equal(2, f32Values.Length);
468Assert.Equal(2, i64Values.Length);
471Assert.Equal(2, i32Values.Length);
474Assert.Equal(2, i16Values.Length);
477Assert.Equal(2, i8Values.Length);
480Assert.Equal(2, u64Values.Length);
483Assert.Equal(2, u32Values.Length);
486Assert.Equal(2, u16Values.Length);
489Assert.Equal(2, u8Values.Length);
492Assert.Equal(2, bValues.Length);
Microsoft.ML.TestFramework (3)
Microsoft.ML.TestFrameworkCommon (2)
Microsoft.ML.Tests (16)
Microsoft.ML.TimeSeries (2)
Microsoft.ML.Tokenizers (318)
Model\BPETokenizer.cs (41)
860span = span.Slice(0, span.Length - EndOfWordSuffix.Length);
957sSpan = sSpan.Slice(0, sSpan.Length - EndOfWordSuffix!.Length);
964if (sSpan.Length > buffer.Length)
971charsWritten += sSpan.Length;
972buffer = buffer.Slice(sSpan.Length);
1017if (specialTokenSpan.Length > buffer.Length)
1023buffer = buffer.Slice(specialTokenSpan.Length);
1024charsWritten += specialTokenSpan.Length;
1036span = span.Slice(0, span.Length - EndOfWordSuffix.Length);
1046if (current.Length < span.Length)
1051for (int i = 0; i < span.Length; i++)
1056current = utf8bytes.Slice(incompleteUtf8BytesInBufferIndex, incompleteUtf8BytesInBuffer + span.Length);
1192Word word = Word.WithCapacity(w.Length);
1199while (i < w.Length)
1203if (Char.IsHighSurrogate(w[i]) && i < w.Length - 1 && Char.IsLowSurrogate(w[i + 1]))
1217if (ContinuingSubwordPrefix.Length + s.Length <= buffer.Length)
1221s = buffer.Slice(0, ContinuingSubwordPrefix.Length + s.Length);
1235if (i + length >= w.Length && EndOfWordSuffix is not null)
1237if (s.Length + EndOfWordSuffix.Length <= buffer.Length)
1240EndOfWordSuffix.AsSpan().CopyTo(buffer.Slice(s.Length));
1241s = buffer.Slice(0, s.Length + EndOfWordSuffix.Length);
1311tokens.Add(new EncodedToken(value.specialTokenId, value.specialToken, new Range(offset, offset + text.Length)));
1323int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length);
1354if (textSpan.Length <= MaxWordLengthToCache)
1421charsConsumed = text.Length;
1436int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length);
1459int res = WordToIds(ref hit, accumulatedIds, out charsConsumed, textSpan.Length, maxTokens);
1462charsConsumed = charsConsumed >= textSpan.Length ? text.Length : mapping[charsConsumed];
1470if (textSpan.Length <= MaxWordLengthToCache)
1480int result = WordToIds(ref word, accumulatedIds, out charsConsumed, textSpan.Length, maxTokens);
1483charsConsumed = charsConsumed >= textSpan.Length ? text.Length : mapping[charsConsumed];
1516int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length);
1539int res = WordToIdsFromEnd(ref hit, accumulatedIds, out textIndex, textSpan.Length, maxTokens);
1543textIndex = textIndex >= textSpan.Length ? text.Length : mapping[textIndex];
1551if (textSpan.Length <= MaxWordLengthToCache)
1561int result = WordToIdsFromEnd(ref word, accumulatedIds, out textIndex, textSpan.Length, maxTokens);
1565textIndex = textIndex >= textSpan.Length ? text.Length : mapping[textIndex];
Model\CodeGenTokenizer.cs (40)
345if (span.Length + 1 > BufferLength)
347mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1);
352span = mutatedInputSpan.Slice(0, span.Length + 1);
385PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length);
401int index = addPrefixSpace ? Math.Max(0, textSpanToEncode.Length - 1) : textSpanToEncode.Length;
405return new EncodeResults<EncodedToken> { Tokens = tokens, NormalizedText = normalizedText, CharsConsumed = textSpanToEncode.Length };
435tokens.Add(new EncodedToken(value.specialTokenId, value.specialToken, new Range(index, index + ((addPrefixSpace && offset == 0) ? textSpan.Length - 1 : textSpan.Length))));
452int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(textSpan.Length);
466if (textSpan.Length <= MaxTokenLengthToCache)
602if (span.Length + 1 > BufferLength)
604mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1);
609span = mutatedInputSpan.Slice(0, span.Length + 1);
625PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length);
821if (span.Length + 1 > BufferLength)
823mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1);
828span = mutatedInputSpan.Slice(0, span.Length + 1);
837PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length);
958if (span.Length + 1 > BufferLength)
960mutatedInputText = ArrayPool<char>.Shared.Rent(span.Length + 1);
965span = mutatedInputSpan.Slice(0, span.Length + 1);
974PriorityQueue<SymbolPair> agenda = new(textSpanToEncode.Length);
1119charsConsumed = textSpan.Length;
1125return EncodeToIdsResult(hit, accumulatedIds, maxTokens, textSpan.Length, out charsConsumed);
1135int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(textSpan.Length);
1149int length = text is not null ? text.Length : textSpan.Length;
1155return EncodeToIdsResult(result, accumulatedIds, maxTokens, textSpan.Length, out charsConsumed);
1172textIndex = textSpan.Length;
1189return EncodeToIdsFromEndResult(hit, accumulatedIds, maxTokens, textSpan.Length, out textIndex);
1199int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(textSpan.Length);
1213int length = text is not null ? text.Length : textSpan.Length;
1219return EncodeToIdsFromEndResult(result, accumulatedIds, maxTokens, textSpan.Length, out textIndex);
1452if (specialTokenSpan.Length > buffer.Length)
1458buffer = buffer.Slice(specialTokenSpan.Length);
1459charsWritten += specialTokenSpan.Length;
1472if (current.Length < span.Length)
1477for (int i = 0; i < span.Length; i++)
1482current = utf8bytes.Slice(incompleteUtf8BytesInBufferIndex, incompleteUtf8BytesInBuffer + span.Length);
1682int endIndex = index + length < mapping.Length ? mapping[index + length] : originalText.Length;
Model\EnglishRobertaTokenizer.cs (15)
363char[] token = ArrayPool<char>.Shared.Rent(text.Length);
364int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length);
369for (int i = 0; i < text.Length; i++)
672return EncodeToIdsResult(hit, accumulatedIds, maxTokens, text.Length, out charsConsumed);
675char[] token = ArrayPool<char>.Shared.Rent(text.Length);
676int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length);
681for (int i = 0; i < text.Length; i++)
695charsConsumed = text.Length;
704return EncodeToIdsResult(result, accumulatedIds, maxTokens, text.Length, out charsConsumed);
711textIndex = text.Length;
717return EncodeToIdsFromEndResult(hit, accumulatedIds, maxTokens, text.Length, out textIndex);
720char[] token = ArrayPool<char>.Shared.Rent(text.Length);
721int[] indexMapping = ArrayPool<int>.Shared.Rent(text.Length);
726for (int i = 0; i < text.Length; i++)
749return EncodeToIdsFromEndResult(result, accumulatedIds, maxTokens, text.Length, out textIndex);
Model\TiktokenTokenizer.cs (20)
323int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length);
329indexMappingSpan[encodedLength] = text.Length;
341if (text.Length <= MaxWordLengthToCache)
430return EncodeToIdsResult(value, accumulatedIds, maxTokenCount, text.Length, out charsConsumed);
435charsConsumed = text.Length;
440int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length);
446indexMappingSpan[encodedLength] = text.Length;
455if (text.Length <= MaxWordLengthToCache)
461return EncodeToIdsResult(encodedTokens, accumulatedIds, maxTokenCount, text.Length, out charsConsumed);
596return EncodeToIdsResult(value, accumulatedIds: null, maxTokens, text.Length, out charsConsumed);
601charsConsumed = text.Length;
605int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length);
611indexMappingSpan[encodedLength] = text.Length;
620if (text.Length <= MaxWordLengthToCache)
626return EncodeToIdsResult(encodedTokens, accumulatedIds: null, maxTokens, text.Length, out charsConsumed);
722return EncodeToIdsFromEndResult(value, accumulatedIds: null, maxTokens, text.Length, out textIndex);
731int utf8Length = Encoding.UTF8.GetMaxByteCount(text.Length);
737indexMappingSpan[encodedLength] = text.Length;
746if (text.Length <= MaxWordLengthToCache)
752return EncodeToIdsFromEndResult(encodedTokens, accumulatedIds: null, maxTokens, text.Length, out textIndex);
Microsoft.ML.Tokenizers.Tests (24)
Microsoft.ML.TorchSharp (16)
Microsoft.ML.Transforms (100)
Microsoft.Net.Http.Headers (11)
Microsoft.NET.StringTools (18)
Microsoft.Private.Windows.Polyfills.Tests (1)
PresentationBuildTasks (11)
PresentationCore (6)
PresentationFramework (45)
PresentationUI (3)
RepoTasks (22)
Roslyn.Diagnostics.Analyzers (49)
Roslyn.Diagnostics.CSharp.Analyzers (1)
Shared (14)
System.Collections (3)
System.Collections.Immutable (45)
System.Collections.Specialized (1)
System.ComponentModel.Annotations (1)
System.ComponentModel.TypeConverter (17)
System.Console (12)
System.Data.Common (25)
System.Data.Odbc (43)
System.Diagnostics.DiagnosticSource (44)
System.Diagnostics.FileVersionInfo (1)
System.Diagnostics.Process (11)
System.DirectoryServices.Protocols (1)
System.Drawing.Common (79)
System\Drawing\Drawing2D\GraphicsPath.cs (22)
43if (pts.Length != types.Length)
52PInvokeGdiPlus.GdipCreatePath2((GdiPlus.PointF*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed();
79if (pts.Length != types.Length)
88PInvokeGdiPlus.GdipCreatePath2I((GdiPlus.Point*)p, t, types.Length, (GdiPlus.FillMode)fillMode, &path).ThrowIfFailed();
334if (points.Length == 0)
341PInvokeGdiPlus.GdipAddPathLine2(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed();
361if (points.Length == 0)
368PInvokeGdiPlus.GdipAddPathLine2I(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed();
413PInvokeGdiPlus.GdipAddPathBeziers(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed();
435if (points.Length == 0)
440PInvokeGdiPlus.GdipAddPathBeziersI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed();
499points.Length,
547points.Length,
575PInvokeGdiPlus.GdipAddPathClosedCurve2(_nativePath, (GdiPlus.PointF*)p, points.Length, tension).ThrowIfFailed();
605PInvokeGdiPlus.GdipAddPathClosedCurve2I(_nativePath, (GdiPlus.Point*)p, points.Length, tension).ThrowIfFailed();
634PInvokeGdiPlus.GdipAddPathRectangles(_nativePath, (RectF*)r, rects.Length).ThrowIfFailed();
654PInvokeGdiPlus.GdipAddPathRectanglesI(_nativePath, (Rect*)r, rects.Length).ThrowIfFailed();
743PInvokeGdiPlus.GdipAddPathPolygon(_nativePath, (GdiPlus.PointF*)p, points.Length).ThrowIfFailed();
764PInvokeGdiPlus.GdipAddPathPolygonI(_nativePath, (GdiPlus.Point*)p, points.Length).ThrowIfFailed();
915destPoints.Length,
System\Drawing\Graphics.cs (31)
770CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectangles(NativeGraphics, pen.NativePen, (RectF*)r, rects.Length));
795CheckErrorStatus(PInvokeGdiPlus.GdipDrawRectanglesI(NativeGraphics, pen.NativePen, (Rect*)r, rects.Length));
869CheckErrorStatus(PInvokeGdiPlus.GdipDrawPolygon(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length));
894CheckErrorStatus(PInvokeGdiPlus.GdipDrawPolygonI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length));
929CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurve(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length));
954(GdiPlus.PointF*)p, points.Length,
990(GdiPlus.PointF*)p, points.Length,
1014CheckErrorStatus(PInvokeGdiPlus.GdipDrawCurveI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length));
1039(GdiPlus.Point*)p, points.Length,
1072(GdiPlus.Point*)p, points.Length,
1100(GdiPlus.PointF*)p, points.Length));
1131(GdiPlus.PointF*)p, points.Length,
1156(GdiPlus.Point*)p, points.Length));
1182(GdiPlus.Point*)p, points.Length,
1266CheckErrorStatus(PInvokeGdiPlus.GdipFillRectangles(NativeGraphics, brush.NativeBrush, (RectF*)r, rects.Length));
1288CheckErrorStatus(PInvokeGdiPlus.GdipFillRectanglesI(NativeGraphics, brush.NativeBrush, (Rect*)r, rects.Length));
1321(GdiPlus.PointF*)p, points.Length,
1360(GdiPlus.Point*)p, points.Length,
1463(GdiPlus.PointF*)p, points.Length));
1504(GdiPlus.PointF*)p, points.Length,
1531(GdiPlus.Point*)p, points.Length));
1567(GdiPlus.Point*)p, points.Length,
1749c, s.Length,
1811text.Length,
1979text.Length,
2377CheckErrorStatus(PInvokeGdiPlus.GdipDrawLines(NativeGraphics, pen.NativePen, (GdiPlus.PointF*)p, points.Length));
2424CheckErrorStatus(PInvokeGdiPlus.GdipDrawLinesI(NativeGraphics, pen.NativePen, (GdiPlus.Point*)p, points.Length));
2606pts.Length));
2632pts.Length));
2807(GdiPlus.PointF*)p, points.Length));
2839points.Length));
System\Drawing\Icon.cs (2)
551_handle = PInvoke.CreateIconFromResourceEx(b, (uint)bestImage.Length, fIcon: true, 0x00030000, 0, 0, 0);
558_handle = PInvoke.CreateIconFromResourceEx(b, (uint)bestImage.Length, fIcon: true, 0x00030000, 0, 0, 0);
System.Drawing.Primitives (3)
System.Formats.Asn1 (124)
System.Formats.Cbor (24)
System.Formats.Nrbf (3)
System.Formats.Tar (41)
System.IO.Compression (36)
System.IO.Compression.Brotli (11)
System.IO.Compression.ZipFile (1)
System.IO.FileSystem.DriveInfo (6)
System.IO.FileSystem.Watcher (21)
System.IO.Hashing (73)
System.IO.Packaging (9)
System.IO.Pipelines (2)
System.IO.Pipes (1)
System.IO.Ports (1)
System.Linq (44)
System.Memory (58)
System.Memory.Data (2)
System.Net.Http (168)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
42if (buffer.Length != 0)
System.Net.HttpListener (13)
System.Net.Mail (37)
System.Net.NameResolution (7)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port);
118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System.Net.NetworkInformation (21)
System.Net.Ping (8)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port);
118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System.Net.Primitives (44)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port);
118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System.Net.Quic (57)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port);
118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System.Net.Requests (1)
System.Net.Security (135)
src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.NetSecurityNative.cs (8)
125inputBytes.Length,
155inputBytes.Length,
186inputBytes.Length,
247return Wrap(out minorStatus, contextHandle, ref isEncrypt, inputBytesPtr, inputBytes.Length, ref outBuffer);
260return Unwrap(out minorStatus, contextHandle, out isEncrypt, inputBytesPtr, inputBytes.Length, ref outBuffer);
272return GetMic(out minorStatus, contextHandle, inputBytesPtr, inputBytes.Length, ref outBuffer);
285return VerifyMic(out minorStatus, contextHandle, inputBytesPtr, inputBytes.Length, tokenBytesPtr, tokenBytes.Length);
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (22)
364Debug.Assert(HeaderLength == NtlmHeader.Length);
381if (length == 0 || offset + length > payload.Length)
403SetField(ref field, data.Length, offset);
405offset += data.Length;
423if (password.Length > 128)
454Debug.Assert(serverChallenge.Length == ChallengeLength);
456Debug.Assert(ntlm2hash.Length == DigestLength);
458Span<byte> blob = payload.Slice(payloadOffset, sizeof(NtChallengeResponse) + serverInfo.Length);
466serverInfo.CopyTo(MemoryMarshal.CreateSpan(ref temp.ServerInfo[0], serverInfo.Length));
521byte[] targetInfoBuffer = new byte[targetInfo.Length + 20 /* channel binding */ + 4 + spnSize /* SPN */ + 8 /* flags */];
526if (targetInfo.Length > 0)
529while (info.Length >= 4)
625!NtlmHeader.SequenceEqual(blob.Slice(0, NtlmHeader.Length)))
789if (signature.Length != SignatureLength ||
823Span<byte> output = outputWriter.GetSpan(input.Length + SignatureLength);
824_clientSeal.Transform(input, output.Slice(SignatureLength, input.Length));
829outputWriter.Advance(input.Length + SignatureLength);
843if (input.Length < SignatureLength)
848Span<byte> output = outputWriter.GetSpan(input.Length - SignatureLength);
849_serverSeal.Transform(input.Slice(SignatureLength), output.Slice(0, input.Length - SignatureLength));
850if (!VerifyMIC(output.Slice(0, input.Length - SignatureLength), input.Slice(0, SignatureLength)))
856outputWriter.Advance(input.Length - SignatureLength);
System.Net.ServerSentEvents (12)
System.Net.Sockets (16)
src\libraries\Common\src\System\Net\SocketAddressPal.Unix.cs (4)
66err = Interop.Sys.GetAddressFamily(rawAddress, buffer.Length, (int*)&family);
94err = Interop.Sys.GetPort(rawAddress, buffer.Length, &port);
118err = Interop.Sys.GetIPv4Address(rawAddress, buffer.Length, &ipAddress);
132err = Interop.Sys.GetIPv6Address(rawAddress, buffer.Length, ipAddress, address.Length, &localScope);
System.Net.WebClient (14)
System.Net.WebHeaderCollection (1)
System.Net.WebSockets (14)
System.Net.WebSockets.Client (2)
System.Numerics.Tensors (381)
System\Numerics\Tensors\netcore\Common\TensorPrimitives.IUnaryInputBinaryOutput.cs (47)
51if (x.Length > destination1.Length)
56if (x.Length > destination2.Length)
63ValidateOutputSpansNonOverlapping(x.Length, destination1, destination2);
72oneVectorFromEnd = x.Length - Vector512<T>.Count;
87if (i != x.Length)
89i = x.Length - Vector512<T>.Count;
102oneVectorFromEnd = x.Length - Vector256<T>.Count;
117if (i != x.Length)
119i = x.Length - Vector256<T>.Count;
132oneVectorFromEnd = x.Length - Vector128<T>.Count;
147if (i != x.Length)
149i = x.Length - Vector128<T>.Count;
160while (i < x.Length)
178if (x.Length != y.Length)
183if (x.Length > destination1.Length)
188if (x.Length > destination2.Length)
197ValidateOutputSpansNonOverlapping(x.Length, destination1, destination2);
207oneVectorFromEnd = x.Length - Vector512<T>.Count;
222if (i != x.Length)
224Vector512<T> mask = Vector512.Equals(CreateRemainderMaskVector512<T>(x.Length - i), Vector512<T>.Zero);
226i = x.Length - Vector512<T>.Count;
255oneVectorFromEnd = x.Length - Vector256<T>.Count;
270if (i != x.Length)
272Vector256<T> mask = Vector256.Equals(CreateRemainderMaskVector256<T>(x.Length - i), Vector256<T>.Zero);
274i = x.Length - Vector256<T>.Count;
303oneVectorFromEnd = x.Length - Vector128<T>.Count;
318if (i != x.Length)
320Vector128<T> mask = Vector128.Equals(CreateRemainderMaskVector128<T>(x.Length - i), Vector128<T>.Zero);
322i = x.Length - Vector128<T>.Count;
349while (i < x.Length)
367if (x.Length > destination1.Length)
372if (x.Length > destination2.Length)
379ValidateOutputSpansNonOverlapping(x.Length, destination1, destination2);
388oneVectorFromEnd = x.Length - Vector512<T>.Count;
405if (i != x.Length)
407Vector512<T> mask = Vector512.Equals(CreateRemainderMaskVector512<T>(x.Length - i), Vector512<T>.Zero);
409i = x.Length - Vector512<T>.Count;
438oneVectorFromEnd = x.Length - Vector256<T>.Count;
455if (i != x.Length)
457Vector256<T> mask = Vector256.Equals(CreateRemainderMaskVector256<T>(x.Length - i), Vector256<T>.Zero);
459i = x.Length - Vector256<T>.Count;
488oneVectorFromEnd = x.Length - Vector128<T>.Count;
505if (i != x.Length)
507Vector128<T> mask = Vector128.Equals(CreateRemainderMaskVector128<T>(x.Length - i), Vector128<T>.Zero);
509i = x.Length - Vector128<T>.Count;
536while (i < x.Length)
System\Numerics\Tensors\netcore\TensorPrimitives.CosineSimilarity.cs (42)
52if (x.Length != y.Length)
61if (Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported && x.Length >= Vector512<T>.Count)
71int oneVectorFromEnd = x.Length - Vector512<T>.Count;
85if (i != x.Length)
87Vector512<T> remainderMask = CreateRemainderMaskVector512<T>(x.Length - i);
90Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<T>.Count)) & remainderMask,
91Vector512.LoadUnsafe(ref yRef, (uint)(x.Length - Vector512<T>.Count)) & remainderMask,
98if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count)
108int oneVectorFromEnd = x.Length - Vector256<T>.Count;
122if (i != x.Length)
124Vector256<T> remainderMask = CreateRemainderMaskVector256<T>(x.Length - i);
127Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count)) & remainderMask,
128Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<T>.Count)) & remainderMask,
135if (Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported && x.Length >= Vector128<T>.Count)
145int oneVectorFromEnd = x.Length - Vector128<T>.Count;
159if (i != x.Length)
161Vector128<T> remainderMask = CreateRemainderMaskVector128<T>(x.Length - i);
164Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<T>.Count)) & remainderMask,
165Vector128.LoadUnsafe(ref yRef, (uint)(x.Length - Vector128<T>.Count)) & remainderMask,
175for (int i = 0; i < x.Length; i++)
191if (x.Length != y.Length)
201if (Vector512.IsHardwareAccelerated && x.Length >= Vector512<short>.Count)
212int oneVectorFromEnd = x.Length - Vector512<short>.Count;
227if (i != x.Length)
229Vector512<short> remainderMask = CreateRemainderMaskVector512<short>(x.Length - i);
232Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<short>.Count)) & remainderMask);
234Vector512.LoadUnsafe(ref yRef, (uint)(x.Length - Vector512<short>.Count)) & remainderMask);
243if (Vector256.IsHardwareAccelerated && x.Length >= Vector256<short>.Count)
254int oneVectorFromEnd = x.Length - Vector256<short>.Count;
269if (i != x.Length)
271Vector256<short> remainderMask = CreateRemainderMaskVector256<short>(x.Length - i);
274Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<short>.Count)) & remainderMask);
276Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<short>.Count)) & remainderMask);
285if (Vector128.IsHardwareAccelerated && x.Length >= Vector128<short>.Count)
296int oneVectorFromEnd = x.Length - Vector128<short>.Count;
311if (i != x.Length)
313Vector128<short> remainderMask = CreateRemainderMaskVector128<short>(x.Length - i);
316Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<short>.Count)) & remainderMask);
318Vector128.LoadUnsafe(ref yRef, (uint)(x.Length - Vector128<short>.Count)) & remainderMask);
330for (int i = 0; i < x.Length; i++)
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (29)
22if (x.Length != y.Length)
28for (int i = 0; i < x.Length; i++)
55MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(x)), x.Length),
56MemoryMarshal.CreateReadOnlySpan(ref Unsafe.As<T, ushort>(ref MemoryMarshal.GetReference(y)), y.Length));
65if (x.Length != y.Length)
75if (Vector128.IsHardwareAccelerated && Vector128<T>.IsSupported && x.Length >= Vector128<T>.Count)
77if (Vector256.IsHardwareAccelerated && Vector256<T>.IsSupported && x.Length >= Vector256<T>.Count)
79if (Vector512.IsHardwareAccelerated && Vector512<T>.IsSupported && x.Length >= Vector512<T>.Count)
84int oneVectorFromEnd = x.Length - Vector512<T>.Count;
98if (i != x.Length)
100Vector512<T> xVec = Vector512.LoadUnsafe(ref xRef, (uint)(x.Length - Vector512<T>.Count));
101Vector512<T> yVec = Vector512.LoadUnsafe(ref yRef, (uint)(x.Length - Vector512<T>.Count));
103Vector512<T> remainderMask = CreateRemainderMaskVector512<T>(x.Length - i);
116int oneVectorFromEnd = x.Length - Vector256<T>.Count;
130if (i != x.Length)
132Vector256<T> xVec = Vector256.LoadUnsafe(ref xRef, (uint)(x.Length - Vector256<T>.Count));
133Vector256<T> yVec = Vector256.LoadUnsafe(ref yRef, (uint)(x.Length - Vector256<T>.Count));
135Vector256<T> remainderMask = CreateRemainderMaskVector256<T>(x.Length - i);
149int oneVectorFromEnd = x.Length - Vector128<T>.Count;
163if (i != x.Length)
165Vector128<T> xVec = Vector128.LoadUnsafe(ref xRef, (uint)(x.Length - Vector128<T>.Count));
166Vector128<T> yVec = Vector128.LoadUnsafe(ref yRef, (uint)(x.Length - Vector128<T>.Count));
168Vector128<T> remainderMask = CreateRemainderMaskVector128<T>(x.Length - i);
178for (int i = 0; i < x.Length; i++)
189for (int i = 0; i < x.Length; i++)
198Debug.Assert(count >= 0 && count <= x.Length, $"Expected count to be in the range [0, {x.Length}], got {count}.");
System.Private.CoreLib (2143)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Utf8Parser\Utf8Parser.Date.Default.cs (1)
18if (source.Length < 26)
src\libraries\System.Private.CoreLib\src\System\Convert.cs (38)
2349if (bytes.Length == 0)
2361int outputLength = ToBase64_CalculateAndValidateOutputLength(bytes.Length, insertLineBreaks: true);
2423if (bytes.Length == 0)
2431int charLengthRequired = ToBase64_CalculateAndValidateOutputLength(bytes.Length, insertLineBreaks);
2455Debug.Assert(destination.Length >= ToBase64_CalculateAndValidateOutputLength(source.Length, insertLineBreaks: true));
2461int chunkSize = Math.Min(source.Length, Base64LineBreakPosition / 4 * 3); // 76 base64 chars == 57 bytes
2585if (chars.Length == 0)
2590if (!int.IsEvenInteger(chars.Length))
2595byte[] result = GC.AllocateUninitializedArray<byte>(chars.Length / 2);
2611if (utf8Source.Length == 0)
2616if (!int.IsEvenInteger(utf8Source.Length))
2621byte[] result = GC.AllocateUninitializedArray<byte>(utf8Source.Length / 2);
2659(int quotient, int remainder) = Math.DivRem(source.Length, 2);
2681source = source.Slice(0, source.Length - 1);
2699charsConsumed = source.Length;
2715(int quotient, int remainder) = Math.DivRem(utf8Source.Length, 2);
2737utf8Source = utf8Source.Slice(0, utf8Source.Length - 1);
2755bytesConsumed = utf8Source.Length;
2799if (bytes.Length == 0)
2803ArgumentOutOfRangeException.ThrowIfGreaterThan(bytes.Length, int.MaxValue / 2, nameof(bytes));
2815if (source.Length == 0)
2820else if ((source.Length > (int.MaxValue / 2)) || (destination.Length < (source.Length * 2)))
2827charsWritten = source.Length * 2;
2838if (source.Length == 0)
2843else if ((source.Length > (int.MaxValue / 2)) || (utf8Destination.Length < (source.Length * 2)))
2850bytesWritten = source.Length * 2;
2894if (bytes.Length == 0)
2898ArgumentOutOfRangeException.ThrowIfGreaterThan(bytes.Length, int.MaxValue / 2, nameof(bytes));
2910if (source.Length == 0)
2915else if ((source.Length > (int.MaxValue / 2)) || (destination.Length < (source.Length * 2)))
2922charsWritten = source.Length * 2;
2933if (source.Length == 0)
2938else if ((source.Length > (int.MaxValue / 2)) || (utf8Destination.Length < (source.Length * 2)))
2945bytesWritten = source.Length * 2;
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (89)
62return Interop.Globalization.CompareString(_sortHandle, pString1, string1.Length, pString2, string2.Length, options);
70Debug.Assert(target.Length != 0);
91return Interop.Globalization.IndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr);
93return Interop.Globalization.LastIndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr);
121if (target.Length > source.Length)
137endIndex = source.Length - target.Length + 1;
144startIndex = source.Length - target.Length;
154for (; targetIndex < target.Length; targetIndex++, sourceIndex++)
179if (sourceIndex < source.Length - 1 && *(a + sourceIndex + 1) >= 0x80)
185if (sourceIndex < source.Length && *(a + sourceIndex) >= 0x80)
188*matchLengthPtr = target.Length;
212return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
214return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
236if (target.Length > source.Length)
252endIndex = source.Length - target.Length + 1;
259startIndex = source.Length - target.Length;
269for (; targetIndex < target.Length; targetIndex++, sourceIndex++)
283if (sourceIndex < source.Length - 1 && *(a + sourceIndex + 1) >= 0x80)
289if (sourceIndex < source.Length && *(a + sourceIndex) >= 0x80)
292*matchLengthPtr = target.Length;
306return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
308return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
337return Interop.Globalization.StartsWith(_sortHandle, pPrefix, prefix.Length, pSource, source.Length, options, matchLengthPtr);
349int length = Math.Min(source.Length, prefix.Length);
384if (a < ap + source.Length - 1 && *(a + 1) >= 0x80)
386if (b < bp + prefix.Length - 1 && *(b + 1) >= 0x80)
393if (source.Length < prefix.Length)
402if (source.Length > prefix.Length)
411*matchLengthPtr = prefix.Length; // non-linguistic match doesn't change UTF-16 length
420return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr);
431int length = Math.Min(source.Length, prefix.Length);
455if (a < ap + source.Length - 1 && *(a + 1) >= 0x80)
457if (b < bp + prefix.Length - 1 && *(b + 1) >= 0x80)
464if (source.Length < prefix.Length)
473if (source.Length > prefix.Length)
483*matchLengthPtr = prefix.Length; // non-linguistic match doesn't change UTF-16 length
492return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr);
521return Interop.Globalization.EndsWith(_sortHandle, pSuffix, suffix.Length, pSource, source.Length, options, matchLengthPtr);
533int length = Math.Min(source.Length, suffix.Length);
538char* a = ap + source.Length - 1;
539char* b = bp + suffix.Length - 1;
577if (source.Length < suffix.Length)
586if (source.Length > suffix.Length)
596*matchLengthPtr = suffix.Length; // non-linguistic match doesn't change UTF-16 length
605return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr);
616int length = Math.Min(source.Length, suffix.Length);
621char* a = ap + source.Length - 1;
622char* b = bp + suffix.Length - 1;
649if (source.Length < suffix.Length)
658if (source.Length > suffix.Length)
668*matchLengthPtr = suffix.Length; // non-linguistic match doesn't change UTF-16 length
677return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr);
768actualSortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pDest, destination.Length, options);
814return Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options);
862int sortKeyLength = checked((source.Length > 1024 * 1024 / 4) ? 0 : 4 * source.Length);
881sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
904sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.cs (25)
107if (unicode.Length == 0)
114throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode));
183if (ascii.Length > 0 && ascii[^1] == (char)0)
214Debug.Assert(input.Length > 0);
217originalString.Length == input.Length &&
218input.Length == output.Length &&
219Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(input), ref MemoryMarshal.GetReference(output), input.Length))
262Debug.Assert(unicode.Length >= 1, "[IdnMapping.GetAscii] Expected 0 length strings to fail before now.");
265throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode));
283if (unicode.Length <= destination.Length)
286charsWritten = unicode.Length;
296Debug.Assert(unicode.Length >= 1, "[IdnMapping.GetAscii] Expected 0 length strings to fail before now.");
299throw new ArgumentException(SR.Format(SR.Argument_InvalidCharSequence, unicode.Length - 1), nameof(unicode));
325if (unicode.Length == 0)
331for (int i = 0; i < unicode.Length; i++)
371if (iLastDot == -1 && unicode.Length > c_labelLimit)
375if (unicode.Length > c_defaultNameLimit - (IsDot(unicode[^1]) ? 0 : 1))
414if (unicode.Length == 0)
417StringBuilder output = new StringBuilder(unicode.Length);
423while (iNextDot < unicode.Length)
430iNextDot = iNextDot < 0 ? unicode.Length : iNextDot + iAfterLastDot;
436if (iNextDot != unicode.Length)
606if (iNextDot != unicode.Length)
638if (char.IsHighSurrogate(s[index]) && index + 1 < s.Length && char.IsLowSurrogate(s[index + 1]))
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Icu.cs (4)
60int actualLength = Interop.Globalization.ToAscii(flags, unicode, unicode.Length, destination, destination.Length);
104int realLen = Interop.Globalization.ToUnicode(flags, ascii, ascii.Length, output, output.Length);
131int actualLength = Interop.Globalization.ToUnicode(flags, ascii, ascii.Length, destination, destination.Length);
170for (int i = 0; i < s.Length; i++)
src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Nls.cs (6)
46int length = Interop.Normaliz.IdnToAscii(flags, unicode, unicode.Length, output, output.Length);
63int length = Interop.Normaliz.IdnToAscii(flags, unicode, unicode.Length, Span<char>.Empty, 0);
76int actualLength = Interop.Normaliz.IdnToAscii(flags, unicode, unicode.Length, destination, destination.Length);
120int length = Interop.Normaliz.IdnToUnicode(flags, ascii, ascii.Length, output, output.Length);
137int length = Interop.Normaliz.IdnToUnicode(flags, ascii, ascii.Length, Span<char>.Empty, 0);
150int actualLength = Interop.Normaliz.IdnToUnicode(flags, ascii, ascii.Length, destination, destination.Length);
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Icu.cs (5)
35ret = Interop.Globalization.IsNormalized(normalizationForm, pInput, source.Length);
149realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, source.Length, pDest, destination.Length);
188realLen = Interop.Globalization.NormalizeString(normalizationForm, pInput, source.Length, null, 0);
221for (; (uint)i < (uint)s.Length; i++)
243if ((uint)(i + 1) >= (uint)s.Length || !char.IsLowSurrogate(s[i + 1]))
src\libraries\System.Private.CoreLib\src\System\Globalization\Normalization.Nls.cs (3)
24result = Interop.Normaliz.IsNormalizedString(normalizationForm, pInput, source.Length);
136realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, source.Length, pDest, destination.Length);
179realLength = Interop.Normaliz.NormalizeString(normalizationForm, pInput, source.Length, null, 0);
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (309)
337span.Length);
344span.Length);
351span.Length);
358span.Length);
362return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length);
820span.Length);
827span.Length);
834span.Length);
841span.Length);
845return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length);
869span.Length);
876span.Length);
883span.Length);
890span.Length);
897for (int i = 0; i < span.Length; i++)
915for (int i = 0; i < span.Length; i++)
948span.Length);
956span.Length);
960return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
986span.Length);
994span.Length);
1001for (int i = 0; i < span.Length; i++)
1020for (int i = 0; i < span.Length; i++)
1056span.Length);
1065span.Length);
1069return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
1097span.Length);
1106span.Length);
1113for (int i = 0; i < span.Length; i++)
1132for (int i = 0; i < span.Length; i++)
1160span.Length);
1170span.Length);
1174return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length);
1187switch (values.Length)
1210if (sizeof(T) == sizeof(byte) && values.Length == 5)
1221span.Length);
1223else if (sizeof(T) == sizeof(short) && values.Length == 5)
1234span.Length);
1242span.Length,
1244values.Length);
1247for (int i = 0; i < span.Length; i++)
1270switch (values.Length)
1285for (int i = 0; i < span.Length; i++)
1398span.Length);
1405span.Length);
1412span.Length);
1419span.Length);
1423return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length);
1447span.Length);
1454span.Length);
1461span.Length);
1468span.Length);
1475for (int i = span.Length - 1; i >= 0; i--)
1493for (int i = span.Length - 1; i >= 0; i--)
1526span.Length);
1534span.Length);
1538return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
1564span.Length);
1572span.Length);
1579for (int i = span.Length - 1; i >= 0; i--)
1598for (int i = span.Length - 1; i >= 0; i--)
1634span.Length);
1643span.Length);
1647return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
1675span.Length);
1684span.Length);
1691for (int i = span.Length - 1; i >= 0; i--)
1711for (int i = span.Length - 1; i >= 0; i--)
1739span.Length);
1749span.Length);
1753return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length);
1766switch (values.Length)
1773return span.Length - 1;
1790if (sizeof(T) == sizeof(byte) && values.Length == 5)
1801span.Length);
1803else if (sizeof(T) == sizeof(short) && values.Length == 5)
1814span.Length);
1822span.Length,
1824values.Length);
1827for (int i = span.Length - 1; i >= 0; i--)
1850switch (values.Length)
1853return span.Length - 1;
1865for (int i = span.Length - 1; i >= 0; i--)
1933span.Length);
1942span.Length);
1951span.Length);
1960span.Length);
1964return SpanHelpers.IndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2004span.Length);
2013span.Length);
2022span.Length);
2031span.Length);
2035return SpanHelpers.IndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2075span.Length);
2084span.Length);
2093span.Length);
2102span.Length);
2106return SpanHelpers.LastIndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2135return span.Length - 1;
2146span.Length);
2155span.Length);
2164span.Length);
2173span.Length);
2177return SpanHelpers.LastIndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2218span.Length);
2224span.Length);
2230span.Length);
2236span.Length);
2239return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
2259span.Length);
2265span.Length);
2271span.Length);
2277span.Length);
2283for (int i = 0; i < span.Length; i++)
2300for (int i = 0; i < span.Length; i++)
2326span.Length,
2328value.Length);
2333span.Length,
2335value.Length);
2338return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
2355span.Length,
2357value.Length);
2362span.Length,
2364value.Length);
2370if (value.Length == 0)
2414span.Length);
2421span.Length);
2428span.Length);
2435span.Length);
2439return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
2460span.Length);
2467span.Length);
2474span.Length);
2481span.Length);
2488for (int i = span.Length - 1; i >= 0; i--)
2506for (int i = span.Length - 1; i >= 0; i--)
2533span.Length,
2535value.Length);
2541span.Length,
2543value.Length);
2547return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
2565span.Length,
2567value.Length);
2573span.Length,
2575value.Length);
2582if (value.Length == 0)
2584return span.Length;
2589int pos = span.Length;
2678span.Length);
2686span.Length);
2690return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
2713span.Length);
2721span.Length);
2728for (int i = 0; i < span.Length; i++)
2746for (int i = 0; i < span.Length; i++)
2779span.Length);
2788span.Length);
2792return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
2817span.Length);
2826span.Length);
2833for (int i = 0; i < span.Length; i++)
2852for (int i = 0; i < span.Length; i++)
2881switch (values.Length)
2887return SpanHelpers.IndexOfValueType(ref spanRef, valueRef, span.Length);
2894span.Length);
2902span.Length);
2911span.Length);
2921span.Length);
2929return values.Length switch
29321 => SpanHelpers.IndexOfValueType(ref spanRef, valueRef, span.Length),
2937span.Length),
2943span.Length),
2950span.Length),
2958span.Length),
2959_ => ProbabilisticMap.IndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length),
2964return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
2975switch (values.Length)
2992for (int i = 0; i < span.Length; i++)
3098span.Length);
3106span.Length);
3110return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
3133span.Length);
3141span.Length);
3148for (int i = span.Length - 1; i >= 0; i--)
3167for (int i = span.Length - 1; i >= 0; i--)
3200span.Length);
3209span.Length);
3213return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
3238span.Length);
3247span.Length);
3254for (int i = span.Length - 1; i >= 0; i--)
3274for (int i = span.Length - 1; i >= 0; i--)
3303switch (values.Length)
3309return SpanHelpers.LastIndexOfValueType(ref spanRef, valueRef, span.Length);
3316span.Length);
3324span.Length);
3333span.Length);
3343span.Length);
3351return values.Length switch
33541 => SpanHelpers.LastIndexOfValueType(ref spanRef, valueRef, span.Length),
3359span.Length),
3365span.Length),
3372span.Length),
3380span.Length),
3381_ => ProbabilisticMap.LastIndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length),
3386return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
3397switch (values.Length)
3414for (int i = span.Length - 1; i >= 0; i--)
3449int length = span.Length;
3450int otherLength = other.Length;
3485if (span.Length != other.Length)
3500((uint)span.Length) * (nuint)sizeof(T)); // If this multiplication overflows, the Span we got overflows the entire address range. There's no happy outcome for this API in such a case so we choose not to take the overhead of checking.
3504for (int i = 0; i < span.Length; i++)
3518for (int i = 0; i < span.Length; i++)
3541span.Length,
3543other.Length);
3548span.Length,
3550other.Length);
3552return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
3560int minLength = Math.Min(span.Length, other.Length);
3572return span.Length.CompareTo(other.Length);
3591int valueLength = value.Length;
3594return valueLength <= span.Length &&
3601return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength);
3614value.Length <= span.Length &&
3615SequenceEqual(span.Slice(0, value.Length), value, comparer);
3633int spanLength = span.Length;
3634int valueLength = value.Length;
3661value.Length <= span.Length &&
3662SequenceEqual(span.Slice(span.Length - value.Length), value, comparer);
3673span.Length != 0 && (span[0]?.Equals(value) ?? (object?)value is null);
3685span.Length != 0 &&
3697span.Length != 0 && (span[^1]?.Equals(value) ?? (object?)value is null);
3709span.Length != 0 &&
4133return (nuint)byteOffset < (nuint)((nint)span.Length * sizeof(T)) ||
4134(nuint)byteOffset > (nuint)(-((nint)other.Length * sizeof(T)));
4152if ((nuint)byteOffset < (nuint)((nint)span.Length * sizeof(T)) ||
4153(nuint)byteOffset > (nuint)(-((nint)other.Length * sizeof(T))))
4249/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>.
4271/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>.
4297/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>.
4632uint length = (uint)source.Length;
4648((nuint)byteOffset < (nuint)((nint)source.Length * sizeof(T)) ||
4716uint length = (uint)source.Length;
4732((nuint)byteOffset < (nuint)((nint)source.Length * sizeof(T)) ||
4788destination = destination.Slice(0, source.Length);
4790for (int i = 0; i < source.Length; i++)
4801destination = destination.Slice(0, source.Length);
4804for (int i = 0; i < source.Length; i++)
4828if (source.Length > destination.Length)
4840ReplaceAny(destination.Slice(0, source.Length), values, newValue);
4878if (source.Length > destination.Length)
4890ReplaceAnyExcept(destination.Slice(0, source.Length), values, newValue);
4939nuint length = Math.Min((nuint)(uint)span.Length, (nuint)(uint)other.Length);
4966for (int i = 0; i < span.Length; i++)
4974return span.Length;
4998for (int i = 0; i < span.Length; i++)
5006return span.Length;
5013if (other.Length > span.Length)
5015other = other.Slice(0, span.Length);
5018span = span.Slice(0, other.Length);
5148int startInclusive = 0, endExclusive = source.Length;
5201if (separators.IsEmpty && destination.Length > source.Length)
5242if (separators.IsEmpty && destination.Length > source.Length)
5275if (source.Length == 0)
5291endExclusive = source.Length;
5325separatorLength = separatorOrSeparators.Length;
5378endExclusive = source.Length;
5435span.Length);
5442span.Length);
5449span.Length);
5456span.Length);
5463span.Length);
5484span.Length);
5491span.Length);
5498span.Length);
5505span.Length);
5513for (int i = 0; i < span.Length; i++)
5532for (int i = 0; i < span.Length; i++)
5561switch (value.Length)
5575span = span.Slice(pos + value.Length);
5591switch (value.Length)
5605span = span.Slice(pos + value.Length);
5810format.ValidateNumberOfArgs(args.Length);
5811return args.Length switch
5927if (typeof(T) == typeof(char) && separators.Length == 0)
5947_splitMode = separator.Length == 0 ?
5985separatorLength = _separatorBuffer.Length;
6008_startNext = _endCurrent = _source.Length;
6296_pos += value.Length;
6316int paddingRequired = alignment - value.Length;
6325Debug.Assert(alignment > value.Length);
6331_pos += value.Length;
6340_pos += value.Length;
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.Globalization.cs (34)
19for (int i = 0; i < span.Length; i++)
72if (span.Length != value.Length)
74if (value.Length == 0) // span.Length == value.Length == 0
82if (span.Length != value.Length)
84if (value.Length == 0) // span.Length == value.Length == 0
86return Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), span.Length);
111if (span.Length == 0 || other.Length == 0)
112return span.Length - other.Length;
117return Ordinal.CompareStringIgnoreCase(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
133return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
166span.Length,
168value.Length);
205if (destination.Length < source.Length)
212return source.Length;
229if (destination.Length < source.Length)
236return source.Length;
257if (destination.Length < source.Length)
264return source.Length;
281if (destination.Length < source.Length)
288return source.Length;
323=> value.Length <= span.Length
325ref Unsafe.Add(ref MemoryMarshal.GetReference(span), span.Length - value.Length),
327value.Length);
361=> value.Length <= span.Length
362&& Ordinal.EqualsIgnoreCase(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), value.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any1SearchValues.cs (5)
20Debug.Assert(values.Length == 1);
36SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
40SpanHelpers.NonPackedIndexOfValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
44SpanHelpers.LastIndexOfValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2CharPackedIgnoreCaseSearchValues.cs (4)
44PackedSpanHelpers.IndexOfAnyIgnoreCase(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length);
49PackedSpanHelpers.IndexOfAnyExceptIgnoreCase(ref MemoryMarshal.GetReference(span), _e0, _e1, span.Length);
57ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
65ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any2SearchValues.cs (5)
20Debug.Assert(values.Length == 2);
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any3SearchValues.cs (5)
20Debug.Assert(values.Length == 3);
36SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.DontNegate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
40SpanHelpers.NonPackedIndexOfAnyValueType<TImpl, SpanHelpers.Negate<TImpl>>(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
44SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
48SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any4SearchValues.cs (5)
20Debug.Assert(values.Length == 4);
39SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
43SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
47SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
51SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Any5SearchValues.cs (5)
20Debug.Assert(values.Length == 5);
40SpanHelpers.IndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
44SpanHelpers.IndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
48SpanHelpers.LastIndexOfAnyValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
52SpanHelpers.LastIndexOfAnyExceptValueType(ref Unsafe.As<T, TImpl>(ref MemoryMarshal.GetReference(span)), _e0, _e1, _e2, _e3, _e4, span.Length);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AnyByteSearchValues.cs (6)
32ref MemoryMarshal.GetReference(span), span.Length, ref _state);
40ref MemoryMarshal.GetReference(span), span.Length, ref _state);
48ref MemoryMarshal.GetReference(span), span.Length, ref _state);
56ref MemoryMarshal.GetReference(span), span.Length, ref _state);
64ref MemoryMarshal.GetReference(span), span.Length, ref _state);
72ref MemoryMarshal.GetReference(span), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiByteSearchValues.cs (6)
48ref MemoryMarshal.GetReference(span), span.Length, ref _state);
56ref MemoryMarshal.GetReference(span), span.Length, ref _state);
64ref MemoryMarshal.GetReference(span), span.Length, ref _state);
72ref MemoryMarshal.GetReference(span), span.Length, ref _state);
80ref MemoryMarshal.GetReference(span), span.Length, ref _state);
88ref MemoryMarshal.GetReference(span), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\AsciiCharSearchValues.cs (6)
50ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
58ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
66ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
74ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
82ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
90ref Unsafe.As<char, short>(ref MemoryMarshal.GetReference(span)), span.Length, ref _state);
src\libraries\System.Private.CoreLib\src\System\SearchValues\EmptySearchValues.cs (1)
25span.Length - 1;
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticCharSearchValues.cs (4)
26ProbabilisticMap.IndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _map);
29ProbabilisticMapState.IndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length, ref _map);
32ProbabilisticMap.LastIndexOfAny<SearchValues.TrueConst>(ref MemoryMarshal.GetReference(span), span.Length, ref _map);
35ProbabilisticMapState.LastIndexOfAnySimpleLoop<SearchValues.TrueConst, IndexOfAnyAsciiSearcher.Negate>(ref MemoryMarshal.GetReference(span), span.Length, ref _map);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticWithAsciiCharSearchValues.cs (18)
44if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[0]))
61span.Length,
71span.Length,
76if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset]))
87span.Length,
105if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[0]))
110span.Length,
114if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset]))
125span.Length,
141if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[^1]))
160span.Length,
170span.Length,
175if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset]))
186span.Length,
194if (IndexOfAnyAsciiSearcher.IsVectorizationSupported && span.Length >= Vector128<short>.Count && char.IsAscii(span[^1]))
199span.Length,
203if ((uint)offset >= (uint)span.Length || char.IsAscii(span[offset]))
214span.Length,
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (8)
349=> SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(strA), strA.Length, ref MemoryMarshal.GetReference(strB), strB.Length);
710return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32));
743return Marvin.ComputeHash32OrdinalIgnoreCase(ref MemoryMarshal.GetReference(value), value.Length /* in chars, not bytes */, (uint)seed, (uint)(seed >> 32));
796int length = span.Length;
906int length = span.Length;
983return GetNonRandomizedHashCodeOrdinalIgnoreCaseSlow(hash1, hash2, span.Slice(span.Length - length));
988int length = str.Length;
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (82)
90if (args.Length <= 1)
106var strings = new string[args.Length];
110for (int i = 0; i < args.Length; i++)
289int length = checked(str0.Length + str1.Length);
299str1.CopyTo(resultSpan.Slice(str0.Length));
306int length = checked(str0.Length + str1.Length + str2.Length);
316resultSpan = resultSpan.Slice(str0.Length);
319resultSpan = resultSpan.Slice(str1.Length);
328int length = checked(str0.Length + str1.Length + str2.Length + str3.Length);
338resultSpan = resultSpan.Slice(str0.Length);
341resultSpan = resultSpan.Slice(str1.Length);
344resultSpan = resultSpan.Slice(str2.Length);
353int length = checked(str0.Length + str1.Length + str2.Length + str3.Length + str4.Length);
363resultSpan = resultSpan.Slice(str0.Length);
366resultSpan = resultSpan.Slice(str1.Length);
369resultSpan = resultSpan.Slice(str2.Length);
372resultSpan = resultSpan.Slice(str3.Length);
392if (values.Length <= 1)
408for (int i = 0; i < values.Length; i++)
431for (int i = 0; i < values.Length; i++)
538sb.EnsureCapacity(format.Length + args.Length * 8);
634format.ValidateNumberOfArgs(args.Length);
635return args.Length switch
884if (values.Length == 1)
893for (int i = 1; i < values.Length; i++)
1033if (values.Length <= 1)
1040long totalSeparatorsLength = (long)(values.Length - 1) * separator.Length;
1069for (int i = 0; i < values.Length; i++)
1091if (i < values.Length - 1)
1099if (separator.Length == 1)
1105separator.CopyTo(new Span<char>(ref dest, separator.Length));
1108copiedLength += separator.Length;
1222result.EnsureCapacity(searchSpace.Length);
1409Debug.Assert(indices.Length > 0);
1411long dstLength = this.Length + ((long)(newValue.Length - oldValueLength)) * indices.Length;
1421for (int r = 0; r < indices.Length; r++)
1584if ((uint)idx >= (uint)text.Length)
1598if ((uint)nextCharIdx < (uint)text.Length && text[nextCharIdx] == '\n')
1642if ((uint)idx >= (uint)remaining.Length) break; // no more newline chars
1643stride = remaining[idx] == '\r' && (uint)(idx + 1) < (uint)remaining.Length && remaining[idx + 1] == '\n' ? 2 : 1;
1687if (separatorSpan.Length == 1)
1777if (sepList.Length == 0)
1855if (sepList.Length == 0)
1901if (sepList.Length == 0)
1908? SplitWithPostProcessing(sepList, default, separator.Length, count, options)
1909: SplitWithoutPostProcessing(sepList, default, separator.Length, count);
1925int numActualReplaces = (sepList.Length < count) ? sepList.Length : count;
1958int numReplaces = sepList.Length;
2036if (separators.Length == 0)
2038for (int i = 0; i < source.Length; i++)
2048else if (separators.Length <= 3)
2052sep1 = separators.Length > 1 ? separators[1] : sep0;
2053sep2 = separators.Length > 2 ? separators[2] : sep1;
2054if (Vector128.IsHardwareAccelerated && source.Length >= Vector128<ushort>.Count * 2)
2060for (int i = 0; i < source.Length; i++)
2077for (int i = 0; i < source.Length; i++)
2095Debug.Assert(sourceSpan.Length >= Vector128<ushort>.Count);
2096nuint lengthToExamine = (uint)sourceSpan.Length;
2221i += separator.Length;
2222source = source.Slice(index + separator.Length);
2237for (int i = 0; i < source.Length; i++)
2239for (int j = 0; j < separators.Length; j++)
2247if (source[i] == separator[0] && currentSepLength <= source.Length - i)
2426index += trimChars.Length;
2438endIndex -= trimChars.Length;
2480return TrimHelper(pTrimChars, trimChars.Length, TrimType.Both);
2512index += trimChars.Length;
2554return TrimHelper(pTrimChars, trimChars.Length, TrimType.Head);
2586endIndex -= trimChars.Length;
2628return TrimHelper(pTrimChars, trimChars.Length, TrimType.Tail);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Equality.cs (18)
25=> left.Length == right.Length
26&& Equals<byte, byte, PlainLoader<byte>>(ref MemoryMarshal.GetReference(left), ref MemoryMarshal.GetReference(right), (uint)right.Length);
30=> left.Length == right.Length
31&& Equals<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
39=> left.Length == right.Length
40&& Equals<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
176=> left.Length == right.Length
177&& EqualsIgnoreCase<byte, byte, PlainLoader<byte>>(ref MemoryMarshal.GetReference(left), ref MemoryMarshal.GetReference(right), (uint)right.Length);
181=> left.Length == right.Length
182&& EqualsIgnoreCase<byte, ushort, WideningLoader>(ref MemoryMarshal.GetReference(left), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
190=> left.Length == right.Length
191&& EqualsIgnoreCase<ushort, ushort, PlainLoader<ushort>>(ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(left)), ref Unsafe.As<char, ushort>(ref MemoryMarshal.GetReference(right)), (uint)right.Length);
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (8)
146return GetByteCountCommon(charsPtr, chars.Length);
321return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
331int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false);
393int numElementsToConvert = Math.Min(chars.Length, bytes.Length);
488return GetCharCountCommon(bytesPtr, bytes.Length);
612return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
622int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false);
681int numElementsToConvert = Math.Min(bytes.Length, chars.Length);
src\libraries\System.Private.CoreLib\src\System\Text\Decoder.cs (3)
114return GetCharCount(bytesPtr, bytes.Length, flush);
201return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length, flush);
307Convert(bytesPtr, bytes.Length, charsPtr, chars.Length, flush, out bytesUsed, out charsUsed, out completed);
src\libraries\System.Private.CoreLib\src\System\Text\Encoder.cs (3)
112return GetByteCount(charsPtr, chars.Length, flush);
198return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length, flush);
306Convert(charsPtr, chars.Length, bytesPtr, bytes.Length, flush, out charsUsed, out bytesUsed, out completed);
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.cs (5)
585return GetByteCount(charsPtr, chars.Length);
732return GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length);
787return GetCharCount(bytesPtr, bytes.Length);
881return GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length);
917return string.CreateStringFromEncoding(bytesPtr, bytes.Length, this);
src\libraries\System.Private.CoreLib\src\System\Text\Encoding.Internal.cs (15)
273charsLength: chars.Length,
366charsLength: chars.Length,
550charsLength: chars.Length,
571encoder._charsUsed = originalCharCount - chars.Length; // total number of characters consumed up until now
608Debug.Assert(charsConsumedThisIteration == chars.Length, "If returning NeedMoreData, should out the entire buffer length as chars consumed.");
653charsLength: chars.Length,
697Debug.Assert(originalCharsLength >= chars.Length, "About to report a negative number of chars used?");
698encoder._charsUsed = originalCharsLength - chars.Length; // number of chars consumed
873bytesLength: bytes.Length,
962bytesLength: bytes.Length,
1153bytesLength: bytes.Length,
1210Debug.Assert(bytesConsumedThisIteration == bytes.Length, "If returning NeedMoreData, should out the entire buffer length as bytes consumed.");
1253bytesLength: bytes.Length,
1294Debug.Assert(originalBytesLength >= bytes.Length, "About to report a negative number of bytes used?");
1295decoder._bytesUsed = originalBytesLength - bytes.Length; // number of bytes consumed
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Encoding.cs (7)
85return GetByteCountCommon(charsPtr, chars.Length);
233return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
243int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false);
380return bytes.Length;
528return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
535if (bytes.Length <= chars.Length)
540charsWritten = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (33)
962long insertingChars = (long)value.Length * count;
973ReplaceInPlaceAtChunk(ref chunk!, ref indexInChunk, ref MemoryMarshal.GetReference(value), value.Length);
1120Append(ref MemoryMarshal.GetReference(value), value.Length);
1303for (int i = 1; i < values.Length; i++)
1443if (value.Length != 0)
1445Insert(index, ref MemoryMarshal.GetReference(value), value.Length);
1734if ((uint)index >= (uint)args.Length)
1781if (itemFormatSpan.Length != 0)
1917format.ValidateNumberOfArgs(args.Length);
1918return args.Length switch
2060if (span.Length != Length)
2075if (!chunk.EqualsOrdinal(span.Slice(span.Length - offset, chunk_length)))
2126if (oldValue.Length == 0)
2145while (oldValue.Length <= remainingChunk.Length)
2156remainingChunk = remainingChunk.Slice(foundPos + oldValue.Length);
2157indexInChunk += oldValue.Length;
2158count -= foundPos + oldValue.Length;
2173int move = remainingChunk.Length - (oldValue.Length - 1);
2180Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2181$"oldValue.Length = {oldValue.Length}, chunk.m_ChunkLength - indexInChunk = {chunk.m_ChunkLength - indexInChunk}, count == {count}");
2189indexInChunk += oldValue.Length;
2190count -= oldValue.Length;
2211ReplaceAllInChunk(replacements.AsSpan(), chunk, oldValue.Length, newValue);
2212index += (newValue.Length - oldValue.Length) * replacements.Length;
2431long longDelta = (value.Length - removeCount) * (long)replacements.Length;
2452ReplaceInPlaceAtChunk(ref targetChunk!, ref targetIndexInChunk, ref MemoryMarshal.GetReference<char>(value), value.Length);
2455if ((uint)i >= replacements.Length)
2492for (int i = 0; i < value.Length; i++)
3197int paddingRequired = alignment - value.Length;
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (6)
196return GetByteCountCommon(charsPtr, chars.Length);
368return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
378int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false);
489return GetCharCountCommon(bytesPtr, bytes.Length);
563return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
573int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false);
src\System\RuntimeHandles.cs (6)
1869ResolveType(new QCallModule(ref module), typeToken, typeInstArgs, typeInstantiationContextHandles.Length, methodInstArgs, methodInstantiationContextHandles.Length, ObjectHandleOnStack.Create(ref type));
1924return ResolveMethod(new QCallModule(ref module), methodToken, typeInstArgs, typeInstantiationContext.Length, methodInstArgs, methodInstantiationContext.Length);
1975ResolveField(new QCallModule(ref module), fieldToken, typeInstArgs, typeInstantiationContextHandles.Length, methodInstArgs, methodInstantiationContextHandles.Length, ObjectHandleOnStack.Create(ref field));
System.Private.CoreLib.Generators (8)
System.Private.DataContractSerialization (52)
System\Xml\XmlBinaryWriter.cs (19)
607if (chars.Length > 0)
611UnsafeWriteText(pch, chars.Length);
862WriteArray(XmlBinaryNodeType.BoolTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
869WriteArray(XmlBinaryNodeType.Int16TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
873WriteArrayInfo(XmlBinaryNodeType.Int16TextWithEndElement, items.Length);
885WriteArray(XmlBinaryNodeType.Int32TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
889WriteArrayInfo(XmlBinaryNodeType.Int32TextWithEndElement, items.Length);
901WriteArray(XmlBinaryNodeType.Int64TextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
905WriteArrayInfo(XmlBinaryNodeType.Int64TextWithEndElement, items.Length);
917WriteArray(XmlBinaryNodeType.FloatTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
921WriteArrayInfo(XmlBinaryNodeType.FloatTextWithEndElement, items.Length);
935WriteArray(XmlBinaryNodeType.DoubleTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
939WriteArrayInfo(XmlBinaryNodeType.DoubleTextWithEndElement, items.Length);
953WriteArray(XmlBinaryNodeType.DecimalTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
958WriteArrayInfo(XmlBinaryNodeType.DecimalTextWithEndElement, items.Length);
976WriteArrayInfo(XmlBinaryNodeType.DateTimeTextWithEndElement, items.Length);
987WriteArray(XmlBinaryNodeType.GuidTextWithEndElement, items.Length, MemoryMarshal.AsBytes(items));
992WriteArrayInfo(XmlBinaryNodeType.GuidTextWithEndElement, items.Length);
1004WriteArrayInfo(XmlBinaryNodeType.TimeSpanTextWithEndElement, items.Length);
System.Private.Uri (109)
System.Private.Windows.Core (43)
System.Private.Windows.GdiPlus (4)
System.Private.Xml (52)
System.Reflection.Emit (3)
System.Reflection.Metadata (39)
System.Reflection.MetadataLoadContext (1)
System.Resources.Extensions (7)
System.Runtime.Numerics (491)
System\Number.BigInteger.cs (58)
85if (value.Length == 0)
91if (value.Length < 255)
93buffer = stackalloc byte[value.Length + 1 + 1];
97buffer = arrayFromPool = ArrayPool<byte>.Shared.Rent(value.Length + 1 + 1);
151for (whiteIndex = 0; whiteIndex < value.Length; whiteIndex++)
163for (whiteIndex = value.Length - 1; whiteIndex >= 0; whiteIndex--)
182int leadingBitsCount = value.Length % TParser.DigitsPerBlock;
237int wholeBlockCount = value.Length / TParser.DigitsPerBlock;
339ReadOnlySpan<byte> fracDigitsSpan = number.Digits.Slice(intDigits.Length);
356int base1E9Length = (intDigits.Length + PowersOf1e9.MaxPartialDigits - 1) / PowersOf1e9.MaxPartialDigits;
363ReadOnlySpan<byte> leadingDigits = intDigits[..(intDigits.Length % PowersOf1e9.MaxPartialDigits)];
364if (leadingDigits.Length != 0)
369intDigits = intDigits.Slice(leadingDigits.Length);
370Debug.Assert(intDigits.Length % PowersOf1e9.MaxPartialDigits == 0);
377Debug.Assert(intDigits.Length == 0);
412int valueDigits = (base1E9.Length - 1) * PowersOf1e9.MaxPartialDigits + FormattingHelpers.CountDigits(base1E9[^1]);
426int leadingLength = checked((int)(digitRatio * PowersOf1e9.MaxPartialDigits * base1E9.Length) + 3);
457if (base1E9.Length < BigIntegerParseNaiveThresholdInRecursive)
464while (base1E9.Length <= multiplier1E9Length)
471Debug.Assert(multiplier1E9Length < base1E9.Length && base1E9.Length <= multiplier1E9Length * 2);
484Span<uint> bitsUpper = bits.Slice(multiplierTrailingZeroCount, buffer2.Length + multiplier.Length);
499if (base1E9.Length == 0)
527if (base1E9.Length == 0)
532for (int i = base1E9.Length - 2; i >= 0; i--)
756Debug.Assert(formatString == null || formatString.Length == formatSpan.Length);
826int valueDigits = (base1E9Value.Length - 1) * PowersOf1e9.MaxPartialDigits + FormattingHelpers.CountDigits(base1E9Value[^1]);
834int strLength = strDigits + sNegative.Length;
958for (int i = 0; i < base1E9Value.Length - 1; i++)
978if (bits.Length <= ToStringNaiveThreshold)
984PowersOf1e9.FloorBufferSize(bits.Length, out int powersOf1e9BufferLength, out int maxIndex);
1003Debug.Assert(bits.Length == 0 || bits[^1] != 0);
1006if (bits.Length <= ToStringNaiveThreshold)
1015while (bits.Length < powOfTen.Length + omittedLength || BigIntegerCalculator.Compare(bits.Slice(omittedLength), powOfTen) < 0)
1022int upperLength = bits.Length - powOfTen.Length - omittedLength + 1;
1028int lowerLength = bits.Length;
1070for (int iuSrc = bits.Length; --iuSrc >= 0;)
1212Debug.Assert(Indexes[6] == LeadingPowers1E9.Length);
1213if (pow1E9.Length <= LeadingPowers1E9.Length)
1218LeadingPowers1E9.CopyTo(pow1E9.Slice(0, LeadingPowers1E9.Length));
1223for (int i = 6; i + 1 < Indexes.Length; i++)
1225Debug.Assert(2 * src.Length - (Indexes[i + 1] - Indexes[i]) is 0 or 1);
1226if (pow1E9.Length - toExclusive < (src.Length << 1))
1228Span<uint> dst = pow1E9.Slice(toExclusive, src.Length << 1);
1243if ((uint)index < (uint)Indexes.Length)
1247maxIndex = Indexes.Length - 2;
1275int hi = Indexes.Length - 1;
1295if (trailingZeroCount < UInt32PowersOfTen.Length)
1297BigIntegerCalculator.Multiply(left, UInt32PowersOfTen[trailingZeroCount], bits.Slice(0, left.Length + 1));
1316int curLength = first.Length;
1331Debug.Assert(fi + 1 < Indexes.Length);
1338Span<uint> dst = powersOfTen2.Slice(0, curLength += power.Length);
1356Span<uint> bits2 = bits.Slice(omittedLength, curLength += left.Length);
1415Debug.Assert(destination.Length * TParser.DigitsPerBlock == input.Length);
1416ref TChar lastWholeBlockStart = ref Unsafe.Add(ref MemoryMarshal.GetReference(input), input.Length - TParser.DigitsPerBlock);
System\Numerics\BigIntegerCalculator.DivRem.cs (118)
36Debug.Assert(left.Length >= 1);
37Debug.Assert(quotient.Length == left.Length);
44for (int i = left.Length - 1; i >= 0; i--)
55Debug.Assert(left.Length >= 1);
59for (int i = left.Length - 1; i >= 0; i--)
70Debug.Assert(left.Length >= 1);
71Debug.Assert(right.Length >= 1);
72Debug.Assert(left.Length >= right.Length);
73Debug.Assert(quotient.Length == left.Length - right.Length + 1);
74Debug.Assert(remainder.Length == left.Length);
78if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold)
91Debug.Assert(left.Length >= 1);
92Debug.Assert(right.Length >= 1);
93Debug.Assert(left.Length >= right.Length);
94Debug.Assert(quotient.Length == left.Length - right.Length + 1);
97if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold)
105Span<uint> leftCopy = (left.Length <= StackAllocThreshold ?
107: leftCopyFromPool = ArrayPool<uint>.Shared.Rent(left.Length)).Slice(0, left.Length);
123Debug.Assert(left.Length >= 1);
124Debug.Assert(right.Length >= 1);
125Debug.Assert(left.Length >= right.Length);
126Debug.Assert(remainder.Length == left.Length);
129if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold)
138int quotientLength = left.Length - right.Length + 1;
162Debug.Assert(right.Length >= 1);
163Debug.Assert(left.Length >= right.Length);
164Debug.Assert(quotient.Length == left.Length - right.Length + 1
168if (right.Length < DivideBurnikelZieglerThreshold || left.Length - right.Length < DivideBurnikelZieglerThreshold)
188int quotientLength = left.Length - right.Length + 1;
211Debug.Assert(right.Length >= 1);
212Debug.Assert(left.Length >= right.Length);
215|| quotient.Length == left.Length - right.Length + 1
216|| (CompareActual(left.Slice(left.Length - right.Length), right) < 0 && quotient.Length == left.Length - right.Length));
223uint divHi = right[right.Length - 1];
224uint divLo = right.Length > 1 ? right[right.Length - 2] : 0;
233uint divNx = right.Length > 2 ? right[right.Length - 3] : 0;
241for (int i = left.Length; i >= right.Length; i--)
243int n = i - right.Length;
295Debug.Assert(left.Length >= right.Length);
301for (int i = 0; i < right.Length; i++)
314Debug.Assert(left.Length >= right.Length);
322for (int i = 0; i < right.Length; i++)
357Debug.Assert(left.Length >= 1);
358Debug.Assert(right.Length >= 1);
359Debug.Assert(left.Length >= right.Length);
360Debug.Assert(quotient.Length == left.Length - right.Length + 1);
361Debug.Assert(remainder.Length == left.Length
373int m = (int)BitOperations.RoundUpToPowerOf2((uint)right.Length / (uint)DivideBurnikelZieglerThreshold + 1);
375int j = (right.Length + m - 1) / m; // Ceil(right.Length/m)
379int sigmaDigit = n - right.Length;
388int aLength = left.Length + sigmaDigit;
406Debug.Assert(src.Length + sigmaDigit <= bits.Length);
411dst.Slice(src.Length).Clear();
523Debug.Assert(left.Length == 2 * right.Length);
524Debug.Assert(CompareActual(left.Slice(right.Length), right) < 0);
525Debug.Assert(quotient.Length == right.Length);
526Debug.Assert(remainder.Length >= right.Length + 1);
528Debug.Assert(right.Length < DivideBurnikelZieglerThreshold);
532if (left.Length < right.Length)
536remainder.Slice(left.Length).Clear();
538else if (right.Length == 1)
542if (quotient.Length < left.Length)
544Debug.Assert(quotient.Length + 1 == left.Length);
553quotient.Slice(left.Length).Clear();
566Span<uint> r1 = (left.Length <= StackAllocThreshold ?
568: r1FromPool = ArrayPool<uint>.Shared.Rent(left.Length)).Slice(0, left.Length);
571int quotientLength = Math.Min(left.Length - right.Length + 1, quotient.Length);
595Debug.Assert(left.Length == 2 * right.Length);
596Debug.Assert(CompareActual(left.Slice(right.Length), right) < 0);
597Debug.Assert(quotient.Length == right.Length);
598Debug.Assert(remainder.Length >= right.Length + 1);
601if ((right.Length & 1) != 0 || right.Length < DivideBurnikelZieglerThreshold)
607int halfN = right.Length >> 1;
610Span<uint> r1 = ((right.Length + 1) <= StackAllocThreshold ?
612: r1FromPool = ArrayPool<uint>.Shared.Rent(right.Length + 1)).Slice(0, right.Length + 1);
614BurnikelZieglerD3n2n(left.Slice(right.Length), left.Slice(halfN, halfN), right, quotient.Slice(halfN), r1);
615BurnikelZieglerD3n2n(r1.Slice(0, right.Length), left.Slice(0, halfN), right, quotient.Slice(0, halfN), remainder);
624Debug.Assert(right.Length % 2 == 0);
625Debug.Assert(left12.Length == right.Length);
626Debug.Assert(2 * left3.Length == right.Length);
627Debug.Assert(2 * quotient.Length == right.Length);
628Debug.Assert(remainder.Length >= right.Length + 1);
632int n = right.Length >> 1;
639Span<uint> d = (right.Length <= StackAllocThreshold ?
641: dFromPool = ArrayPool<uint>.Shared.Rent(right.Length)).Slice(0, right.Length);
685Debug.Assert(bits.Length == left.Length + right.Length);
689bits = bits.Slice(0, left.Length + right.Length);
System\Numerics\BigIntegerCalculator.FastReducer.cs (15)
26Debug.Assert(r.Length == modulus.Length * 2 + 1);
27Debug.Assert(mu.Length == r.Length - modulus.Length + 1);
28Debug.Assert(q1.Length == modulus.Length * 2 + 2);
29Debug.Assert(q2.Length == modulus.Length * 2 + 2);
46Debug.Assert(value.Length <= _modulus.Length * 2);
49if (value.Length < _modulus.Length)
54int l1 = DivMul(value, _mu, _q1, _modulus.Length - 1);
58int l2 = DivMul(_q1.Slice(0, l1), _modulus, _q2, _modulus.Length + 1);
61var length = SubMod(value, _q2.Slice(0, l2), _modulus, _modulus.Length + 1);
72Debug.Assert(bits.Length + k >= left.Length + right.Length);
79if (left.Length > k)
82bits = bits.Slice(0, left.Length + right.Length);
101if (right.Length > k)
System\Numerics\BigIntegerCalculator.PowMod.cs (32)
23Debug.Assert(bits.Length == PowBound(power, value.Length));
36valueCopy.Slice(value.Length).Clear();
38Span<uint> result = PowCore(valueCopy, value.Length, temp, power, bits);
74int resultLength = leftLength + right.Length;
163for (int i = 0; i < power.Length - 1; i++)
175return PowCore(value, power[power.Length - 1], modulus, result);
205Debug.Assert(bits.Length == modulus.Length + modulus.Length);
211int size = Math.Max(value.Length, bits.Length);
219valueCopy.Slice(value.Length).Clear();
221if (value.Length > modulus.Length)
223Remainder(value, modulus, valueCopy.Slice(0, value.Length));
254Debug.Assert(bits.Length == modulus.Length + modulus.Length);
259int size = Math.Max(value.Length, bits.Length);
268valueCopy.Slice(value.Length).Clear();
270if (value.Length > modulus.Length)
272Remainder(value, modulus, valueCopy.Slice(0, value.Length));
309if (modulus.Length < ReducerThreshold)
317int size = modulus.Length * 2 + 1;
324size = r.Length - modulus.Length + 1;
331size = modulus.Length * 2 + 2;
369if (modulus.Length < ReducerThreshold)
377int size = modulus.Length * 2 + 1;
384size = r.Length - modulus.Length + 1;
391size = modulus.Length * 2 + 2;
433for (int i = 0; i < power.Length - 1; i++)
449return PowCore(value, valueLength, power[power.Length - 1], modulus, result, resultLength, temp);
492for (int i = 0; i < power.Length - 1; i++)
508return PowCore(value, valueLength, power[power.Length - 1], reducer, result, resultLength, temp);
System\Numerics\BigIntegerCalculator.SquMul.cs (102)
25Debug.Assert(bits.Length == value.Length + value.Length);
37if (value.Length < MultiplyKaratsubaThreshold)
41else if (value.Length < MultiplyToom3Threshold)
52Debug.Assert(value.Length >= 3);
53Debug.Assert(bits.Length >= value.Length + value.Length);
61int n = (value.Length + 2) / 3;
90Debug.Assert(bits.Length == value.Length + value.Length);
101int n = value.Length >> 1;
118int foldLength = valueHigh.Length + 1;
152Debug.Assert(bits.Length == value.Length + value.Length);
170for (int i = 0; i < value.Length; i++)
190Debug.Assert(bits.Length == left.Length + 1);
200for (; i < left.Length; i++)
212if (left.Length < right.Length)
219Debug.Assert(left.Length >= right.Length);
220Debug.Assert(right.Length >= 0);
221Debug.Assert(right.IsEmpty || bits.Length >= left.Length + right.Length);
236if (right.Length < MultiplyKaratsubaThreshold)
238else if ((left.Length + 1) >> 1 is int n && right.Length <= n)
240else if (right.Length < MultiplyToom3Threshold)
247Debug.Assert(left.Length >= 3);
248Debug.Assert(left.Length >= right.Length);
249Debug.Assert(bits.Length >= left.Length + right.Length);
257int n = (left.Length + 2) / 3;
259Debug.Assert(right.Length > n);
260if (((uint)right.Length << 1) <= (uint)n)
295Debug.Assert(3 * n - left.Length is 0 or 1 or 2);
296Debug.Assert(right.Length > n);
297Debug.Assert(right.Length <= 2 * n);
298Debug.Assert(bits.Length >= left.Length + right.Length);
308Span<uint> z0 = bits.Slice(0, left0.Length + right0.Length);
330if (left0.Length < left2.Length)
406Debug.Assert(left.Length >= right.Length);
407Debug.Assert(bits.Length >= left.Length + right.Length);
411Debug.Assert(2 * n - left.Length is 0 or 1);
412Debug.Assert(right.Length > n);
426Debug.Assert(leftLow.Length >= leftHigh.Length);
427Debug.Assert(rightLow.Length >= rightHigh.Length);
474Debug.Assert(ActualLength(core) <= left.Length + 1);
485Debug.Assert(left.Length >= right.Length);
486Debug.Assert(2 * n - left.Length is 0 or 1);
487Debug.Assert(right.Length <= n);
488Debug.Assert(bits.Length >= left.Length + right.Length);
494Debug.Assert(leftLow.Length >= leftHigh.Length);
497Span<uint> bitsLow = bits.Slice(0, n + right.Length);
503int carryLength = right.Length;
509Span<uint> carryOrig = bitsHigh.Slice(0, right.Length);
514Multiply(leftHigh, right, bitsHigh.Slice(0, leftHigh.Length + right.Length));
524Debug.Assert(right.Length < MultiplyKaratsubaThreshold);
537for (int i = 0; i < right.Length; i++)
541for (int j = 0; j < left.Length; j++)
548Unsafe.Add(ref resultPtr, i + left.Length) = (uint)carry;
575Debug.Assert(value.Length > n);
583if (value.Length <= n + n)
653Debug.Assert(cInf.Length >= right.cInf.Length);
673Span<uint> r0 = bits.Slice(0, p0.Length + q0.Length);
676? bits.Slice(4 * n, pInf.Length + qInf.Length)
679Span<uint> r1 = buffer.Slice(0, p1.Length + q1.Length);
680Span<uint> rm1 = buffer.Slice(rLength, pm1.Length + qm1.Length);
681Span<uint> rm2 = buffer.Slice(rLength * 2, pm2.Length + qm2.Length);
716Span<uint> r0 = bits.Slice(0, p0.Length << 1);
717Span<uint> rInf = bits.Slice(4 * n, pInf.Length << 1);
719Span<uint> r1 = buffer.Slice(0, p1.Length << 1);
720Span<uint> rm1 = buffer.Slice(rLength, pm1.Length << 1);
721Span<uint> rm2 = buffer.Slice(rLength * 2, pm2.Length << 1);
861Debug.Assert(left.Length >= right.Length);
862Debug.Assert(core.Length >= left.Length);
879for (; i < right.Length; i++)
886for (; i < left.Length; i++)
904Debug.Assert(left.Length >= right.Length);
916Debug.Assert(left.Length >= right.Length);
947left = left.Slice(0, right.Length);
955Debug.Assert(left.Length >= right.Length);
984left = left.Slice(0, right.Length);
System.Security.Cryptography (631)
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Kdf.cs (10)
76ikm.Length,
79salt.Length,
81info.Length,
103prk.Length,
106info.Length,
128ikm.Length,
131salt.Length,
154key.Length,
157label.Length,
159context.Length,
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.Mac.cs (6)
72key.Length,
74customizationString.Length,
76data.Length,
131int ret = CryptoNative_EvpMacInit(ctx, key, key.Length, customizationString, customizationString.Length, xof);
143int ret = CryptoNative_EvpMacUpdate(ctx, data, data.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.MLDsa.cs (12)
64SafeEvpPKeyHandle handle = CryptoNative_MLDsaGenerateKey(algorithmName, seed, seed.Length);
92msg, msg.Length,
93context, context.Length,
117msg, msg.Length,
118context, context.Length,
119signature, signature.Length);
148msg, msg.Length,
170msg, msg.Length,
171signature, signature.Length);
203mu, mu.Length,
229mu, mu.Length,
230signature, signature.Length);
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EvpPkey.SlhDsa.cs (8)
91msg, msg.Length,
92context, context.Length,
116msg, msg.Length,
117context, context.Length,
118signature, signature.Length);
147msg, msg.Length,
169msg, msg.Length,
170signature, signature.Length);
src\libraries\Common\src\System\Security\Cryptography\Asn1\RSAPrivateKeyAsn.xml.cs (8)
98decoded.Modulus = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
100decoded.PublicExponent = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
102decoded.PrivateExponent = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
104decoded.Prime1 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
106decoded.Prime2 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
108decoded.Exponent1 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
110decoded.Exponent2 = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
112decoded.Coefficient = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System\Security\Cryptography\ECDsa.cs (7)
909hashSpan = HashData(data.ToArray(), 0, data.Length, hashAlgorithm);
1009byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
1015byte[] hash = HashData(array, 0, data.Length, hashAlgorithm);
1032Array.Clear(array, 0, data.Length);
1218byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
1223byte[] ret = HashData(array, 0, data.Length, hashAlgorithm);
1229Array.Clear(array, 0, data.Length);
System\Security\Cryptography\X509Certificates\Asn1\TbsCertificateAsn.xml.cs (5)
213decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
221decoded.Issuer = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
229decoded.Subject = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
237decoded.IssuerUniqueId = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
252decoded.SubjectUniqueId = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System.Security.Cryptography.Cose (17)
System.Security.Cryptography.Pkcs (138)
System.Security.Cryptography.ProtectedData (3)
System.Security.Cryptography.Xml (10)
System.ServiceModel.NetFramingBase (2)
System.Text.Encoding.CodePages (11)
System.Text.Encodings.Web (42)
System.Text.Json (900)
System\Text\Json\Document\JsonDocument.cs (24)
311int length = checked(otherText.Length * JsonConstants.MaxExpansionFactorWhileTranscoding);
353if (otherUtf8Text.Length > segment.Length || (!shouldUnescape && otherUtf8Text.Length != segment.Length))
360if (otherUtf8Text.Length < segment.Length / JsonConstants.MaxExpansionFactorWhileEscaping)
428consumed == segment.Length)
450consumed == segment.Length)
472consumed == segment.Length)
494consumed == segment.Length)
516consumed == segment.Length)
538consumed == segment.Length)
560consumed == segment.Length)
582consumed == segment.Length)
604segment.Length == bytesConsumed)
626segment.Length == bytesConsumed)
648segment.Length == bytesConsumed)
927database.Append(tokenType, tokenStart, reader.ValueSpan.Length);
974database.Append(tokenType, tokenStart, reader.ValueSpan.Length);
990database.Append(tokenType, tokenStart + 1, reader.ValueSpan.Length);
1015database.Append(tokenType, tokenStart + 1, reader.ValueSpan.Length);
1024database.Append(tokenType, tokenStart, reader.ValueSpan.Length);
1031Debug.Assert(reader.BytesConsumed == utf8JsonSpan.Length);
System\Text\Json\ThrowHelper.cs (22)
142if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize)
144ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
148Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize);
149ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
156if (propertyName.Length > JsonConstants.MaxUnescapedTokenSize)
158ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
162Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize);
163ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
170if (propertyName.Length > JsonConstants.MaxCharacterTokenSize)
172ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
176Debug.Assert(value.Length > JsonConstants.MaxUnescapedTokenSize);
177ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
184if (propertyName.Length > JsonConstants.MaxCharacterTokenSize)
186ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
190Debug.Assert(value.Length > JsonConstants.MaxCharacterTokenSize);
191ThrowArgumentException(SR.Format(SR.ValueTooLarge, value.Length));
205Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize);
206ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
258Debug.Assert(propertyName.Length > JsonConstants.MaxCharacterTokenSize);
259ThrowArgumentException(SR.Format(SR.PropertyNameTooLarge, propertyName.Length));
534int printFirst10 = Math.Min(value.Length, 10);
549if (printFirst10 < value.Length)
System\Text\Json\Writer\Utf8JsonWriter.WriteProperties.String.cs (121)
27escapedPropertyNameSection.Slice(1, escapedPropertyNameSection.Length - 3);
33Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxUnescapedTokenSize - 3);
45Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize);
95Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2);
112Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length);
119int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp);
158Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize);
159Debug.Assert(escapedPropertyName.Length < (int.MaxValue - 4) / JsonConstants.MaxExpansionFactorWhileTranscoding);
163int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 4;
189Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize);
190Debug.Assert(escapedPropertyName.Length < (int.MaxValue - 5 - indent - _newLineLength) / JsonConstants.MaxExpansionFactorWhileTranscoding);
194int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + 5 + _newLineLength;
244Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2);
271Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length);
278int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp);
319Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize);
320Debug.Assert(escapedPropertyName.Length < int.MaxValue - 4);
322int minRequired = escapedPropertyName.Length + 3; // 2 quotes for property name, and 1 colon
339BytesPending += escapedPropertyName.Length;
349Debug.Assert(escapedPropertyNameSection.Length <= JsonConstants.MaxEscapedTokenSize - 3);
350Debug.Assert(escapedPropertyNameSection.Length < int.MaxValue - 4);
352int maxRequired = escapedPropertyNameSection.Length + 1; // Optionally, 1 list separator
367BytesPending += escapedPropertyNameSection.Length;
377Debug.Assert(escapedPropertyName.Length <= JsonConstants.MaxEscapedTokenSize);
378Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - 5 - _newLineLength);
380int minRequired = indent + escapedPropertyName.Length + 4; // 2 quotes for property name, 1 colon, and 1 space
408BytesPending += escapedPropertyName.Length;
428Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize && utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize);
595Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize);
601Debug.Assert(valueIdx >= -1 && valueIdx < value.Length && valueIdx < int.MaxValue / 2);
682Debug.Assert(utf8PropertyName.Length <= JsonConstants.MaxUnescapedTokenSize);
688Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length && valueIdx < int.MaxValue / 2);
769Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize);
775Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2);
841Debug.Assert(utf8Value.Length <= JsonConstants.MaxUnescapedTokenSize);
847Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2);
896Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length);
897Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < utf8Value.Length);
901int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndex);
919Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length);
920Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < value.Length);
924int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndex);
942Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length);
943Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < propertyName.Length);
947int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndex);
965Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length);
966Debug.Assert(firstEscapeIndex >= 0 && firstEscapeIndex < utf8PropertyName.Length);
970int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndex);
991Debug.Assert(valueIdx >= -1 && valueIdx < value.Length && valueIdx < int.MaxValue / 2);
992Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2);
1010Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length && valueIdx < int.MaxValue / 2);
1011Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2);
1029Debug.Assert(valueIdx >= -1 && valueIdx < utf8Value.Length && valueIdx < int.MaxValue / 2);
1030Debug.Assert(propertyIdx >= -1 && propertyIdx < propertyName.Length && propertyIdx < int.MaxValue / 2);
1048Debug.Assert(valueIdx >= -1 && valueIdx < value.Length && valueIdx < int.MaxValue / 2);
1049Debug.Assert(propertyIdx >= -1 && propertyIdx < utf8PropertyName.Length && propertyIdx < int.MaxValue / 2);
1064Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length);
1065Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length);
1073int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal);
1093int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp);
1124Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length);
1125Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length);
1133int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
1153int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp);
1184Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8Value.Length);
1185Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= propertyName.Length);
1193int length = JsonWriterHelper.GetMaxEscapedLength(utf8Value.Length, firstEscapeIndexVal);
1213int length = JsonWriterHelper.GetMaxEscapedLength(propertyName.Length, firstEscapeIndexProp);
1244Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= value.Length);
1245Debug.Assert(int.MaxValue / JsonConstants.MaxExpansionFactorWhileEscaping >= utf8PropertyName.Length);
1253int length = JsonWriterHelper.GetMaxEscapedLength(value.Length, firstEscapeIndexVal);
1273int length = JsonWriterHelper.GetMaxEscapedLength(utf8PropertyName.Length, firstEscapeIndexProp);
1357Debug.Assert(escapedValue.Length <= JsonConstants.MaxUnescapedTokenSize);
1358Debug.Assert(escapedPropertyName.Length < ((int.MaxValue - 6) / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length);
1362int maxRequired = ((escapedPropertyName.Length + escapedValue.Length) * JsonConstants.MaxExpansionFactorWhileTranscoding) + 6;
1392Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1393Debug.Assert(escapedPropertyName.Length < int.MaxValue - escapedValue.Length - 6);
1395int minRequired = escapedPropertyName.Length + escapedValue.Length + 5; // 2 quotes for property name, 2 quotes for value, and 1 colon
1412BytesPending += escapedPropertyName.Length;
1420BytesPending += escapedValue.Length;
1428Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1429Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 6);
1433int maxRequired = (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedValue.Length + 6;
1456BytesPending += escapedValue.Length;
1464Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1465Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 6);
1469int maxRequired = (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedPropertyName.Length + 6;
1485BytesPending += escapedPropertyName.Length;
1503Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1504Debug.Assert(escapedPropertyName.Length < ((int.MaxValue - 7 - indent - _newLineLength) / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length);
1508int maxRequired = indent + ((escapedPropertyName.Length + escapedValue.Length) * JsonConstants.MaxExpansionFactorWhileTranscoding) + 7 + _newLineLength;
1553Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1554Debug.Assert(escapedPropertyName.Length < int.MaxValue - indent - escapedValue.Length - 7 - _newLineLength);
1556int minRequired = indent + escapedPropertyName.Length + escapedValue.Length + 6; // 2 quotes for property name, 2 quotes for value, 1 colon, and 1 space
1584BytesPending += escapedPropertyName.Length;
1593BytesPending += escapedValue.Length;
1604Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1605Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 7 - indent - _newLineLength);
1609int maxRequired = indent + (escapedPropertyName.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedValue.Length + 7 + _newLineLength;
1644BytesPending += escapedValue.Length;
1655Debug.Assert(escapedValue.Length <= JsonConstants.MaxEscapedTokenSize);
1656Debug.Assert(escapedPropertyName.Length < (int.MaxValue / JsonConstants.MaxExpansionFactorWhileTranscoding) - escapedValue.Length - 7 - indent - _newLineLength);
1660int maxRequired = indent + (escapedValue.Length * JsonConstants.MaxExpansionFactorWhileTranscoding) + escapedPropertyName.Length + 7 + _newLineLength;
1687BytesPending += escapedPropertyName.Length;
System.Text.Json.SourceGeneration (15)
System.Text.RegularExpressions (150)
System\Text\RegularExpressions\RegexRunner.cs (12)
142if (s == null || text != s.AsSpan(beginning, text.Length))
159InternalScan(runregex!, beginning, beginning + text.Length);
284runtextend = text.Length;
292new Match(runregex, runregex.capsize, runtext, text.Length) :
293new MatchSparse(runregex, runregex.caps, runregex.capsize, runtext, text.Length);
297m.Reset(runtext, text.Length);
417return ((uint)indexM1 < (uint)inputSpan.Length && RegexCharClass.IsBoundaryWordChar(inputSpan[indexM1])) !=
418((uint)index < (uint)inputSpan.Length && RegexCharClass.IsBoundaryWordChar(inputSpan[index]));
427return (uint)indexMinus1 >= (uint)inputSpan.Length || !RegexCharClass.IsBoundaryWordChar(inputSpan[indexMinus1]);
434(uint)index >= (uint)inputSpan.Length || !RegexCharClass.IsBoundaryWordChar(inputSpan[index]);
448return ((uint)indexM1 < (uint)inputSpan.Length && RegexCharClass.IsECMAWordChar(inputSpan[indexM1])) !=
449((uint)index < (uint)inputSpan.Length && RegexCharClass.IsECMAWordChar(inputSpan[index]));
System.Text.RegularExpressions.Generator (67)
System.Web.HttpUtility (18)
System.Windows.Forms (22)
System.Windows.Forms.Design (10)
System.Windows.Forms.Primitives (87)
System.Windows.Forms.Primitives.Tests (1)
System.Windows.Forms.Primitives.TestUtilities (9)
System.Windows.Forms.Primitives.TestUtilities.Tests (2)
System.Windows.Forms.Tests (7)
System.Windows.Forms.UI.IntegrationTests (8)
System.Xaml (7)
Templates.Blazor.Tests (22)
Templates.Blazor.WebAssembly.Auth.Tests (22)
Templates.Blazor.WebAssembly.Tests (22)
Templates.Mvc.Tests (22)
Templates.Tests (22)
Test.Utilities (48)
Text.Analyzers (49)
UIAutomationClientSideProviders (5)
xunit.assert (6)