9802 references to Length
Aspire.Dashboard (10)
Aspire.Hosting (2)
Aspire.Hosting.Docker (14)
BuildActionTelemetryTable (3)
CodeGenerator (1)
ConfigurationSchemaGenerator (2)
GenerateDocumentationAndConfigFiles (46)
http2cat (27)
IIS.FunctionalTests (27)
IIS.LongTests (27)
IIS.NewHandler.FunctionalTests (27)
IIS.NewShim.FunctionalTests (27)
IIS.ShadowCopy.Tests (8)
IISExpress.FunctionalTests (27)
illink (7)
ILLink.RoslynAnalyzer (28)
InMemory.FunctionalTests (2)
Metrics (47)
Metrics.Legacy (47)
Microsoft.AspNetCore.Authorization (2)
Microsoft.AspNetCore.Components (17)
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 (6)
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 (18)
Microsoft.AspNetCore.Server.HttpSys (7)
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (26)
Microsoft.AspNetCore.Server.IIS (9)
Microsoft.AspNetCore.Server.Kestrel.Core (144)
Microsoft.AspNetCore.Server.Kestrel.Core.Tests (1)
Microsoft.AspNetCore.Server.Kestrel.Microbenchmarks (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Microsoft.AspNetCore.Shared.Tests (52)
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.Tasks.CodeAnalysis (6)
Microsoft.Build.Tasks.CodeAnalysis.Sdk (6)
Microsoft.CodeAnalysis (85)
Microsoft.CodeAnalysis.Analyzers (47)
Microsoft.CodeAnalysis.AnalyzerUtilities (47)
Microsoft.CodeAnalysis.BannedApiAnalyzers (47)
Microsoft.CodeAnalysis.CodeStyle (50)
Microsoft.CodeAnalysis.Collections.Package (1)
Microsoft.CodeAnalysis.CSharp (25)
Microsoft.CodeAnalysis.CSharp.CodeStyle.Fixes (1)
Microsoft.CodeAnalysis.CSharp.EditorFeatures2.UnitTests (1)
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 (47)
Microsoft.CodeAnalysis.PublicApiAnalyzers (47)
Microsoft.CodeAnalysis.ResxSourceGenerator (47)
Microsoft.CodeAnalysis.Test.Utilities (8)
Microsoft.CodeAnalysis.Threading.Package (1)
Microsoft.CodeAnalysis.Workspaces (49)
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (25)
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
Microsoft.CSharp (1)
Microsoft.Data.Analysis (612)
Microsoft.Data.Analysis.Tests (4)
Microsoft.DotNet.StrongName (3)
Microsoft.DotNet.SwaggerGenerator.CodeGenerator (8)
Microsoft.Extensions.AI (6)
Microsoft.Extensions.AI.Abstractions (4)
Microsoft.Extensions.AI.AzureAIInference (4)
Microsoft.Extensions.AI.Evaluation.NLP (6)
Microsoft.Extensions.AI.Evaluation.Quality (1)
Microsoft.Extensions.AI.Integration.Tests (3)
Microsoft.Extensions.AI.OpenAI (12)
Microsoft.Extensions.Caching.Hybrid (3)
Microsoft.Extensions.Compliance.Abstractions (4)
Microsoft.Extensions.Compliance.Abstractions.Tests (2)
Microsoft.Extensions.Compliance.Redaction.Tests (2)
Microsoft.Extensions.DependencyModel (6)
Microsoft.Extensions.Http.Diagnostics (10)
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.Gen.Logging (2)
Microsoft.Gen.Metrics (2)
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 (23)
Microsoft.ML.ImageAnalytics (2)
Microsoft.ML.KMeansClustering (3)
Microsoft.ML.Mkl.Components (5)
Microsoft.ML.OnnxTransformer (2)
Microsoft.ML.PCA (1)
Microsoft.ML.Predictor.Tests (1)
Microsoft.ML.Samples (3)
Microsoft.ML.StandardTrainers (32)
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 (247)
Model\BPETokenizer.cs (41)
856span = span.Slice(0, span.Length - EndOfWordSuffix.Length);
953sSpan = sSpan.Slice(0, sSpan.Length - EndOfWordSuffix!.Length);
960if (sSpan.Length > buffer.Length)
967charsWritten += sSpan.Length;
968buffer = buffer.Slice(sSpan.Length);
1013if (specialTokenSpan.Length > buffer.Length)
1019buffer = buffer.Slice(specialTokenSpan.Length);
1020charsWritten += specialTokenSpan.Length;
1032span = span.Slice(0, span.Length - EndOfWordSuffix.Length);
1042if (current.Length < span.Length)
1047for (int i = 0; i < span.Length; i++)
1052current = utf8bytes.Slice(incompleteUtf8BytesInBufferIndex, incompleteUtf8BytesInBuffer + span.Length);
1188Word word = Word.WithCapacity(w.Length);
1195while (i < w.Length)
1199if (Char.IsHighSurrogate(w[i]) && i < w.Length - 1 && Char.IsLowSurrogate(w[i + 1]))
1213if (ContinuingSubwordPrefix.Length + s.Length <= buffer.Length)
1217s = buffer.Slice(0, ContinuingSubwordPrefix.Length + s.Length);
1231if (i + length >= w.Length && EndOfWordSuffix is not null)
1233if (s.Length + EndOfWordSuffix.Length <= buffer.Length)
1236EndOfWordSuffix.AsSpan().CopyTo(buffer.Slice(s.Length));
1237s = buffer.Slice(0, s.Length + EndOfWordSuffix.Length);
1307tokens.Add(new EncodedToken(value.specialTokenId, value.specialToken, new Range(offset, offset + text.Length)));
1319int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length);
1350if (textSpan.Length <= MaxWordLengthToCache)
1417charsConsumed = text.Length;
1432int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length);
1455int res = WordToIds(ref hit, accumulatedIds, out charsConsumed, textSpan.Length, maxTokens);
1458charsConsumed = charsConsumed >= textSpan.Length ? text.Length : mapping[charsConsumed];
1466if (textSpan.Length <= MaxWordLengthToCache)
1476int result = WordToIds(ref word, accumulatedIds, out charsConsumed, textSpan.Length, maxTokens);
1479charsConsumed = charsConsumed >= textSpan.Length ? text.Length : mapping[charsConsumed];
1512int destinationMaxSize = Encoding.UTF8.GetMaxByteCount(text.Length);
1535int res = WordToIdsFromEnd(ref hit, accumulatedIds, out textIndex, textSpan.Length, maxTokens);
1539textIndex = textIndex >= textSpan.Length ? text.Length : mapping[textIndex];
1547if (textSpan.Length <= MaxWordLengthToCache)
1557int result = WordToIdsFromEnd(ref word, accumulatedIds, out textIndex, textSpan.Length, maxTokens);
1561textIndex = 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);
Utils\Helpers.netstandard.cs (9)
76return Encoding.UTF8.GetBytes(sourcePtr, source.Length, destPtr, destination.Length);
85if (Encoding.UTF8.GetByteCount(sourcePtr, source.Length) <= destination.Length)
87bytesWritten = Encoding.UTF8.GetBytes(sourcePtr, source.Length, destPtr, destination.Length);
100return Encoding.UTF8.GetString(sourcePtr, utf8Bytes.Length);
109return Encoding.UTF8.GetChars(bytesPtr, bytes.Length, charsPtr, chars.Length);
122Debug.Assert(source.Length <= destination.Length);
124for (int i = 0; i < source.Length; i++)
140Debug.Assert(textIndex < text.Length);
167if (textIndex < text.Length - 1 && char.IsSurrogatePair((char)c, text[textIndex + 1]))
Microsoft.ML.Tokenizers.Tests (24)
Microsoft.ML.TorchSharp (16)
Microsoft.ML.Transforms (100)
Microsoft.Net.Http.Headers (11)
Microsoft.NET.StringTools (18)
PresentationBuildTasks (11)
PresentationCore (6)
PresentationFramework (45)
PresentationUI (3)
Roslyn.Diagnostics.Analyzers (47)
Roslyn.Diagnostics.CSharp.Analyzers (1)
Shared (12)
System.Collections (3)
System.Collections.Immutable (45)
System.Collections.Specialized (1)
System.ComponentModel.Annotations (1)
System.ComponentModel.TypeConverter (4)
System.Console (12)
System.Data.Common (12)
System.Diagnostics.DiagnosticSource (45)
System.Diagnostics.FileVersionInfo (1)
System.Diagnostics.Process (10)
System.DirectoryServices.Protocols (1)
System.Drawing.Common (78)
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 (127)
System.Formats.Cbor (24)
System.Formats.Nrbf (3)
System.Formats.Tar (29)
System.IO.Compression (22)
System.IO.Compression.Brotli (11)
System.IO.Compression.ZipFile (1)
System.IO.FileSystem.DriveInfo (6)
System.IO.FileSystem.Watcher (16)
System.IO.Hashing (47)
System.IO.Packaging (9)
System.IO.Pipelines (2)
System.IO.Pipes (1)
System.IO.Ports (1)
System.Linq (43)
System.Memory (58)
System.Memory.Data (3)
System.Net.Http (167)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\Helpers\VariableLengthIntegerHelper.cs (1)
42if (buffer.Length != 0)
System.Net.HttpListener (13)
System.Net.Mail (35)
System.Net.NameResolution (4)
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 (39)
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 (48)
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 (127)
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)
297Debug.Assert(HeaderLength == NtlmHeader.Length);
326if (length == 0 || offset + length > payload.Length)
349SetField(ref field, data.Length, offset);
351offset += data.Length;
369if (password.Length > 128)
400Debug.Assert(serverChallenge.Length == ChallengeLength);
402Debug.Assert(ntlm2hash.Length == DigestLength);
404Span<byte> blob = payload.Slice(payloadOffset, sizeof(NtChallengeResponse) + serverInfo.Length);
412serverInfo.CopyTo(MemoryMarshal.CreateSpan(ref temp.ServerInfo[0], serverInfo.Length));
467byte[] targetInfoBuffer = new byte[targetInfo.Length + 20 /* channel binding */ + 4 + spnSize /* SPN */ + 8 /* flags */];
472if (targetInfo.Length > 0)
475while (info.Length >= 4)
571!NtlmHeader.SequenceEqual(blob.Slice(0, NtlmHeader.Length)))
735if (signature.Length != SignatureLength ||
769Span<byte> output = outputWriter.GetSpan(input.Length + SignatureLength);
770_clientSeal.Transform(input, output.Slice(SignatureLength, input.Length));
775outputWriter.Advance(input.Length + SignatureLength);
789if (input.Length < SignatureLength)
794Span<byte> output = outputWriter.GetSpan(input.Length - SignatureLength);
795_serverSeal.Transform(input.Slice(SignatureLength), output.Slice(0, input.Length - SignatureLength));
796if (!VerifyMIC(output.Slice(0, input.Length - SignatureLength), input.Slice(0, SignatureLength)))
802outputWriter.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 (380)
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 (2078)
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 (49)
2350if (bytes.Length == 0)
2356int outputLength = ToBase64_CalculateAndValidateOutputLength(bytes.Length, insertLineBreaks);
2360if (Vector128.IsHardwareAccelerated && !insertLineBreaks && bytes.Length >= Base64VectorizationLengthThreshold)
2371int charsWritten = ConvertToBase64Array(charsPtr, bytesPtr, 0, bytes.Length, insertLineBreaks);
2436if (bytes.Length == 0)
2444int charLengthRequired = ToBase64_CalculateAndValidateOutputLength(bytes.Length, insertLineBreaks);
2451if (Vector128.IsHardwareAccelerated && !insertLineBreaks && bytes.Length >= Base64VectorizationLengthThreshold)
2460int converted = ConvertToBase64Array(outChars, inData, 0, bytes.Length, insertLineBreaks);
2477Debug.Assert(bytes.Length >= Base64VectorizationLengthThreshold);
2677while (chars.Length != 0)
2688Debug.Assert(chars.Length != 0); // If TryDecodeFromUtf16() consumed the entire buffer, it could not have returned false.
2696if (indexOfFirstNonSpace == chars.Length)
2705if ((bytesWrittenInThisIteration % 3) != 0 && chars.Length != 0)
2717Debug.Assert(chars.Length != 0 && !chars[0].IsSpace());
2745for (int i = 0; i < chars.Length; i++)
2768for (int i = 0; i < chars.Length; i++)
2781consumed = chars.Length;
2940if (chars.Length == 0)
2945if (!int.IsEvenInteger(chars.Length))
2950byte[] result = GC.AllocateUninitializedArray<byte>(chars.Length / 2);
2966if (utf8Source.Length == 0)
2971if (!int.IsEvenInteger(utf8Source.Length))
2976byte[] result = GC.AllocateUninitializedArray<byte>(utf8Source.Length / 2);
3014(int quotient, int remainder) = Math.DivRem(source.Length, 2);
3036source = source.Slice(0, source.Length - 1);
3054charsConsumed = source.Length;
3070(int quotient, int remainder) = Math.DivRem(utf8Source.Length, 2);
3092utf8Source = utf8Source.Slice(0, utf8Source.Length - 1);
3110bytesConsumed = utf8Source.Length;
3154if (bytes.Length == 0)
3158ArgumentOutOfRangeException.ThrowIfGreaterThan(bytes.Length, int.MaxValue / 2, nameof(bytes));
3170if (source.Length == 0)
3175else if ((source.Length > (int.MaxValue / 2)) || (destination.Length < (source.Length * 2)))
3182charsWritten = source.Length * 2;
3193if (source.Length == 0)
3198else if ((source.Length > (int.MaxValue / 2)) || (utf8Destination.Length < (source.Length * 2)))
3205bytesWritten = source.Length * 2;
3249if (bytes.Length == 0)
3253ArgumentOutOfRangeException.ThrowIfGreaterThan(bytes.Length, int.MaxValue / 2, nameof(bytes));
3265if (source.Length == 0)
3270else if ((source.Length > (int.MaxValue / 2)) || (destination.Length < (source.Length * 2)))
3277charsWritten = source.Length * 2;
3288if (source.Length == 0)
3293else if ((source.Length > (int.MaxValue / 2)) || (utf8Destination.Length < (source.Length * 2)))
3300bytesWritten = 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);
92return Interop.Globalization.IndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr);
94return Interop.Globalization.LastIndexOf(_sortHandle, pTarget, target.Length, pSource, source.Length, options, matchLengthPtr);
122if (target.Length > source.Length)
138endIndex = source.Length - target.Length + 1;
145startIndex = source.Length - target.Length;
155for (; targetIndex < target.Length; targetIndex++, sourceIndex++)
180if (sourceIndex < source.Length - 1 && *(a + sourceIndex + 1) >= 0x80)
186if (sourceIndex < source.Length && *(a + sourceIndex) >= 0x80)
189*matchLengthPtr = target.Length;
213return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
215return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
237if (target.Length > source.Length)
253endIndex = source.Length - target.Length + 1;
260startIndex = source.Length - target.Length;
270for (; targetIndex < target.Length; targetIndex++, sourceIndex++)
284if (sourceIndex < source.Length - 1 && *(a + sourceIndex + 1) >= 0x80)
290if (sourceIndex < source.Length && *(a + sourceIndex) >= 0x80)
293*matchLengthPtr = target.Length;
307return Interop.Globalization.IndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
309return Interop.Globalization.LastIndexOf(_sortHandle, b, target.Length, a, source.Length, options, matchLengthPtr);
338return Interop.Globalization.StartsWith(_sortHandle, pPrefix, prefix.Length, pSource, source.Length, options, matchLengthPtr);
350int length = Math.Min(source.Length, prefix.Length);
385if (a < ap + source.Length - 1 && *(a + 1) >= 0x80)
387if (b < bp + prefix.Length - 1 && *(b + 1) >= 0x80)
394if (source.Length < prefix.Length)
403if (source.Length > prefix.Length)
412*matchLengthPtr = prefix.Length; // non-linguistic match doesn't change UTF-16 length
421return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr);
432int length = Math.Min(source.Length, prefix.Length);
456if (a < ap + source.Length - 1 && *(a + 1) >= 0x80)
458if (b < bp + prefix.Length - 1 && *(b + 1) >= 0x80)
465if (source.Length < prefix.Length)
474if (source.Length > prefix.Length)
484*matchLengthPtr = prefix.Length; // non-linguistic match doesn't change UTF-16 length
493return Interop.Globalization.StartsWith(_sortHandle, bp, prefix.Length, ap, source.Length, options, matchLengthPtr);
522return Interop.Globalization.EndsWith(_sortHandle, pSuffix, suffix.Length, pSource, source.Length, options, matchLengthPtr);
534int length = Math.Min(source.Length, suffix.Length);
539char* a = ap + source.Length - 1;
540char* b = bp + suffix.Length - 1;
578if (source.Length < suffix.Length)
587if (source.Length > suffix.Length)
597*matchLengthPtr = suffix.Length; // non-linguistic match doesn't change UTF-16 length
606return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr);
617int length = Math.Min(source.Length, suffix.Length);
622char* a = ap + source.Length - 1;
623char* b = bp + suffix.Length - 1;
650if (source.Length < suffix.Length)
659if (source.Length > suffix.Length)
669*matchLengthPtr = suffix.Length; // non-linguistic match doesn't change UTF-16 length
678return Interop.Globalization.EndsWith(_sortHandle, bp, suffix.Length, ap, source.Length, options, matchLengthPtr);
769actualSortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pDest, destination.Length, options);
815return Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, null, 0, options);
863int sortKeyLength = checked((source.Length > 1024 * 1024 / 4) ? 0 : 4 * source.Length);
882sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
905sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
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);
227for (; (uint)i < (uint)s.Length; i++)
249if ((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 (310)
337span.Length);
344span.Length);
351span.Length);
358span.Length);
362return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length);
816span.Length);
823span.Length);
830span.Length);
837span.Length);
841return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length);
865span.Length);
872span.Length);
879span.Length);
886span.Length);
893for (int i = 0; i < span.Length; i++)
911for (int i = 0; i < span.Length; i++)
944span.Length);
952span.Length);
956return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
982span.Length);
990span.Length);
997for (int i = 0; i < span.Length; i++)
1016for (int i = 0; i < span.Length; i++)
1052span.Length);
1061span.Length);
1065return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
1093span.Length);
1102span.Length);
1109for (int i = 0; i < span.Length; i++)
1128for (int i = 0; i < span.Length; i++)
1156span.Length);
1166span.Length);
1170return SpanHelpers.IndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length);
1183switch (values.Length)
1206if (sizeof(T) == sizeof(byte) && values.Length == 5)
1217span.Length);
1219else if (sizeof(T) == sizeof(short) && values.Length == 5)
1230span.Length);
1238span.Length,
1240values.Length);
1243for (int i = 0; i < span.Length; i++)
1266switch (values.Length)
1281for (int i = 0; i < span.Length; i++)
1394span.Length);
1401span.Length);
1408span.Length);
1415span.Length);
1419return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value, span.Length);
1443span.Length);
1450span.Length);
1457span.Length);
1464span.Length);
1471for (int i = span.Length - 1; i >= 0; i--)
1489for (int i = span.Length - 1; i >= 0; i--)
1522span.Length);
1530span.Length);
1534return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
1560span.Length);
1568span.Length);
1575for (int i = span.Length - 1; i >= 0; i--)
1594for (int i = span.Length - 1; i >= 0; i--)
1630span.Length);
1639span.Length);
1643return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
1671span.Length);
1680span.Length);
1687for (int i = span.Length - 1; i >= 0; i--)
1707for (int i = span.Length - 1; i >= 0; i--)
1735span.Length);
1745span.Length);
1749return SpanHelpers.LastIndexOfAnyExcept(ref MemoryMarshal.GetReference(span), value0, value1, value2, value3, span.Length);
1762switch (values.Length)
1769return span.Length - 1;
1786if (sizeof(T) == sizeof(byte) && values.Length == 5)
1797span.Length);
1799else if (sizeof(T) == sizeof(short) && values.Length == 5)
1810span.Length);
1818span.Length,
1820values.Length);
1823for (int i = span.Length - 1; i >= 0; i--)
1846switch (values.Length)
1849return span.Length - 1;
1861for (int i = span.Length - 1; i >= 0; i--)
1923span.Length);
1932span.Length);
1941span.Length);
1950span.Length);
1954return SpanHelpers.IndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
1988span.Length);
1997span.Length);
2006span.Length);
2015span.Length);
2019return SpanHelpers.IndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2053span.Length);
2062span.Length);
2071span.Length);
2080span.Length);
2084return SpanHelpers.LastIndexOfAnyInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2118span.Length);
2127span.Length);
2136span.Length);
2145span.Length);
2149return SpanHelpers.LastIndexOfAnyExceptInRange(ref MemoryMarshal.GetReference(span), lowInclusive, highInclusive, span.Length);
2190span.Length);
2196span.Length);
2202span.Length);
2208span.Length);
2211return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
2231span.Length);
2237span.Length);
2243span.Length);
2249span.Length);
2255for (int i = 0; i < span.Length; i++)
2272for (int i = 0; i < span.Length; i++)
2298span.Length,
2300value.Length);
2305span.Length,
2307value.Length);
2310return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
2327span.Length,
2329value.Length);
2334span.Length,
2336value.Length);
2342if (value.Length == 0)
2386span.Length);
2393span.Length);
2400span.Length);
2407span.Length);
2411return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
2432span.Length);
2439span.Length);
2446span.Length);
2453span.Length);
2460for (int i = span.Length - 1; i >= 0; i--)
2478for (int i = span.Length - 1; i >= 0; i--)
2505span.Length,
2507value.Length);
2513span.Length,
2515value.Length);
2519return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
2537span.Length,
2539value.Length);
2545span.Length,
2547value.Length);
2554if (value.Length == 0)
2556return span.Length;
2561int pos = span.Length;
2650span.Length);
2658span.Length);
2662return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
2685span.Length);
2693span.Length);
2700for (int i = 0; i < span.Length; i++)
2718for (int i = 0; i < span.Length; i++)
2751span.Length);
2760span.Length);
2764return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
2789span.Length);
2798span.Length);
2805for (int i = 0; i < span.Length; i++)
2824for (int i = 0; i < span.Length; i++)
2853switch (values.Length)
2859return SpanHelpers.IndexOfValueType(ref spanRef, valueRef, span.Length);
2866span.Length);
2874span.Length);
2883span.Length);
2893span.Length);
2901return values.Length switch
29041 => SpanHelpers.IndexOfValueType(ref spanRef, valueRef, span.Length),
2909span.Length),
2915span.Length),
2922span.Length),
2930span.Length),
2931_ => ProbabilisticMap.IndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length),
2936return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
2947switch (values.Length)
2964for (int i = 0; i < span.Length; i++)
3070span.Length);
3078span.Length);
3082return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
3105span.Length);
3113span.Length);
3120for (int i = span.Length - 1; i >= 0; i--)
3139for (int i = span.Length - 1; i >= 0; i--)
3172span.Length);
3181span.Length);
3185return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
3210span.Length);
3219span.Length);
3226for (int i = span.Length - 1; i >= 0; i--)
3246for (int i = span.Length - 1; i >= 0; i--)
3275switch (values.Length)
3281return SpanHelpers.LastIndexOfValueType(ref spanRef, valueRef, span.Length);
3288span.Length);
3296span.Length);
3305span.Length);
3315span.Length);
3323return values.Length switch
33261 => SpanHelpers.LastIndexOfValueType(ref spanRef, valueRef, span.Length),
3331span.Length),
3337span.Length),
3344span.Length),
3352span.Length),
3353_ => ProbabilisticMap.LastIndexOfAny(ref Unsafe.As<short, char>(ref spanRef), span.Length, ref Unsafe.As<short, char>(ref valueRef), values.Length),
3358return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(values), values.Length);
3369switch (values.Length)
3386for (int i = span.Length - 1; i >= 0; i--)
3421int length = span.Length;
3422int otherLength = other.Length;
3457if (span.Length != other.Length)
3472((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.
3476for (int i = 0; i < span.Length; i++)
3490for (int i = 0; i < span.Length; i++)
3513span.Length,
3515other.Length);
3520span.Length,
3522other.Length);
3524return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
3532int minLength = Math.Min(span.Length, other.Length);
3544return span.Length.CompareTo(other.Length);
3563int valueLength = value.Length;
3566return valueLength <= span.Length &&
3573return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength);
3584value.Length <= span.Length &&
3585SequenceEqual(span.Slice(0, value.Length), value, comparer);
3603int spanLength = span.Length;
3604int valueLength = value.Length;
3629value.Length <= span.Length &&
3630SequenceEqual(span.Slice(span.Length - value.Length), value, comparer);
3641span.Length != 0 && (span[0]?.Equals(value) ?? (object?)value is null);
3653span.Length != 0 &&
3665span.Length != 0 && (span[^1]?.Equals(value) ?? (object?)value is null);
3677span.Length != 0 &&
4101return (nuint)byteOffset < (nuint)((nint)span.Length * sizeof(T)) ||
4102(nuint)byteOffset > (nuint)(-((nint)other.Length * sizeof(T)));
4120if ((nuint)byteOffset < (nuint)((nint)span.Length * sizeof(T)) ||
4121(nuint)byteOffset > (nuint)(-((nint)other.Length * sizeof(T))))
4217/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>.
4239/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>.
4265/// no larger element, the bitwise complement of <see cref="ReadOnlySpan{T}.Length"/>.
4582nuint length = (uint)source.Length;
4598((nuint)byteOffset < (nuint)((nint)source.Length * sizeof(T)) ||
4666nuint length = (uint)source.Length;
4682((nuint)byteOffset < (nuint)((nint)source.Length * sizeof(T)) ||
4738for (int i = 0; i < source.Length; i++)
4750for (int i = 0; i < source.Length; i++)
4774if (source.Length > destination.Length)
4786ReplaceAny(destination.Slice(0, source.Length), values, newValue);
4824if (source.Length > destination.Length)
4836ReplaceAnyExcept(destination.Slice(0, source.Length), values, newValue);
4885nuint length = Math.Min((nuint)(uint)span.Length, (nuint)(uint)other.Length);
4912for (int i = 0; i < span.Length; i++)
4920return span.Length;
4944for (int i = 0; i < span.Length; i++)
4952return span.Length;
4959if (other.Length > span.Length)
4961other = other.Slice(0, span.Length);
4963else if (span.Length > other.Length)
4965span = span.Slice(0, other.Length);
4967Debug.Assert(span.Length == other.Length);
5097int startInclusive = 0, endExclusive = source.Length;
5150if (separators.IsEmpty && destination.Length > source.Length)
5191if (separators.IsEmpty && destination.Length > source.Length)
5224if (source.Length == 0)
5240endExclusive = source.Length;
5274separatorLength = separatorOrSeparators.Length;
5327endExclusive = source.Length;
5384span.Length);
5391span.Length);
5398span.Length);
5405span.Length);
5412span.Length);
5433span.Length);
5440span.Length);
5447span.Length);
5454span.Length);
5462for (int i = 0; i < span.Length; i++)
5481for (int i = 0; i < span.Length; i++)
5510switch (value.Length)
5524span = span.Slice(pos + value.Length);
5540switch (value.Length)
5554span = span.Slice(pos + value.Length);
5759format.ValidateNumberOfArgs(args.Length);
5760return args.Length switch
5876if (typeof(T) == typeof(char) && separators.Length == 0)
5896_splitMode = separator.Length == 0 ?
5934separatorLength = _separatorBuffer.Length;
5957_startNext = _endCurrent = _source.Length;
6245_pos += value.Length;
6265int paddingRequired = alignment - value.Length;
6274Debug.Assert(alignment > value.Length);
6280_pos += value.Length;
6289_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)
436=> SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(strA), strA.Length, ref MemoryMarshal.GetReference(strB), strB.Length);
759return Marvin.ComputeHash32(ref Unsafe.As<char, byte>(ref MemoryMarshal.GetReference(value)), (uint)value.Length * 2 /* in bytes, not chars */, (uint)seed, (uint)(seed >> 32));
792return Marvin.ComputeHash32OrdinalIgnoreCase(ref MemoryMarshal.GetReference(value), value.Length /* in chars, not bytes */, (uint)seed, (uint)(seed >> 32));
845int length = span.Length;
955int length = span.Length;
1032return GetNonRandomizedHashCodeOrdinalIgnoreCaseSlow(hash1, hash2, span.Slice(span.Length - length));
1037int length = str.Length;
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)
952long insertingChars = (long)value.Length * count;
963ReplaceInPlaceAtChunk(ref chunk!, ref indexInChunk, ref MemoryMarshal.GetReference(value), value.Length);
1096Append(ref MemoryMarshal.GetReference(value), value.Length);
1279for (int i = 1; i < values.Length; i++)
1404if (value.Length != 0)
1406Insert(index, ref MemoryMarshal.GetReference(value), value.Length);
1699if ((uint)index >= (uint)args.Length)
1746if (itemFormatSpan.Length != 0)
1882format.ValidateNumberOfArgs(args.Length);
1883return args.Length switch
2025if (span.Length != Length)
2040if (!chunk.EqualsOrdinal(span.Slice(span.Length - offset, chunk_length)))
2091if (oldValue.Length == 0)
2110while (oldValue.Length <= remainingChunk.Length)
2121remainingChunk = remainingChunk.Slice(foundPos + oldValue.Length);
2122indexInChunk += oldValue.Length;
2123count -= foundPos + oldValue.Length;
2138int move = remainingChunk.Length - (oldValue.Length - 1);
2145Debug.Assert(oldValue.Length > Math.Min(count, chunk.m_ChunkLength - indexInChunk),
2146$"oldValue.Length = {oldValue.Length}, chunk.m_ChunkLength - indexInChunk = {chunk.m_ChunkLength - indexInChunk}, count == {count}");
2154indexInChunk += oldValue.Length;
2155count -= oldValue.Length;
2176ReplaceAllInChunk(replacements.AsSpan(), chunk, oldValue.Length, newValue);
2177index += (newValue.Length - oldValue.Length) * replacements.Length;
2362long longDelta = (value.Length - removeCount) * (long)replacements.Length;
2383ReplaceInPlaceAtChunk(ref targetChunk!, ref targetIndexInChunk, ref MemoryMarshal.GetReference<char>(value), value.Length);
2386if ((uint)i >= replacements.Length)
2423for (int i = 0; i < value.Length; i++)
3080int 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)
1846ResolveType(new QCallModule(ref module), typeToken, typeInstArgs, typeInstantiationContextHandles.Length, methodInstArgs, methodInstantiationContextHandles.Length, ObjectHandleOnStack.Create(ref type));
1901return ResolveMethod(new QCallModule(ref module), methodToken, typeInstArgs, typeInstantiationContext.Length, methodInstArgs, methodInstantiationContext.Length);
1952ResolveField(new QCallModule(ref module), fieldToken, typeInstArgs, typeInstantiationContextHandles.Length, methodInstArgs, methodInstantiationContextHandles.Length, ObjectHandleOnStack.Create(ref field));
System.Private.CoreLib.Generators (10)
System.Private.DataContractSerialization (39)
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 (57)
System\UriHelper.cs (12)
17return string.Create(span.Length, span, static (buffer, span) =>
138if (destination.Length < charsToEscape.Length)
149charsWritten = charsToEscape.Length;
162vsb.EnsureCapacity(charsToEscape.Length);
172Debug.Assert(newLength > charsToEscape.Length);
209Debug.Assert(backingString is null || backingString.Length == charsToEscape.Length);
223vsb.EnsureCapacity(charsToEscape.Length);
293if (stringToEscape.Length > 2 && char.IsAsciiHexDigit(stringToEscape[1]) && char.IsAsciiHexDigit(stringToEscape[2]))
312charsToCopy = stringToEscape.Length;
377UnescapeString(pStr, 0, input.Length, ref dest, rsvd1, rsvd2, rsvd3, unescapeMode, syntax, isQuery);
613Debug.Assert(backingString is null || strToClean.Length == backingString.Length);
647stripped = string.Create(strToClean.Length - charsToRemove, strToClean, static (buffer, strToClean) =>
System.Private.Windows.Core (30)
System.Private.Windows.GdiPlus (3)
System.Private.Xml (39)
System.Reflection.Emit (3)
System.Reflection.Metadata (39)
System.Reflection.MetadataLoadContext (1)
System.Resources.Extensions (7)
System.Runtime.Numerics (436)
System\Number.BigInteger.cs (51)
85if (value.Length == 0)
90if (value.Length < 255)
92buffer = stackalloc byte[value.Length + 1 + 1];
96buffer = arrayFromPool = ArrayPool<byte>.Shared.Rent(value.Length + 1 + 1);
149for (whiteIndex = 0; whiteIndex < value.Length; whiteIndex++)
161for (whiteIndex = value.Length - 1; whiteIndex >= 0; whiteIndex--)
180int leadingBitsCount = value.Length % TParser.DigitsPerBlock;
235int wholeBlockCount = value.Length / TParser.DigitsPerBlock;
331ReadOnlySpan<byte> fracDigitsSpan = number.Digits.Slice(intDigits.Length);
348int base1E9Length = (intDigits.Length + PowersOf1e9.MaxPartialDigits - 1) / PowersOf1e9.MaxPartialDigits;
355ReadOnlySpan<byte> leadingDigits = intDigits[..(intDigits.Length % PowersOf1e9.MaxPartialDigits)];
356if (leadingDigits.Length != 0)
361intDigits = intDigits.Slice(leadingDigits.Length);
362Debug.Assert(intDigits.Length % PowersOf1e9.MaxPartialDigits == 0);
369Debug.Assert(intDigits.Length == 0);
404int valueDigits = (base1E9.Length - 1) * PowersOf1e9.MaxPartialDigits + FormattingHelpers.CountDigits(base1E9[^1]);
418int leadingLength = checked((int)(digitRatio * PowersOf1e9.MaxPartialDigits * base1E9.Length) + 3);
449if (base1E9.Length < BigIntegerParseNaiveThresholdInRecursive)
456while (base1E9.Length <= multiplier1E9Length)
463Debug.Assert(multiplier1E9Length < base1E9.Length && base1E9.Length <= multiplier1E9Length * 2);
476Span<uint> bitsUpper = bits.Slice(multiplierTrailingZeroCount, buffer2.Length + multiplier.Length);
477if (multiplier.Length < buffer2.Length)
494if (base1E9.Length == 0)
522if (base1E9.Length == 0)
527for (int i = base1E9.Length - 2; i >= 0; i--)
749Debug.Assert(formatString == null || formatString.Length == formatSpan.Length);
823int valueDigits = (base1E9Value.Length - 1) * MaxPartialDigits + FormattingHelpers.CountDigits(base1E9Value[^1]);
858strResult = string.Create(strLength, (digits, ptr: (IntPtr)ptr, base1E9Value.Length, sNegative), static (span, state) =>
929for (int i = 0; i < base1E9Value.Length - 1; i++)
1056Debug.Assert(Indexes[6] == LeadingPowers1E9.Length);
1057if (pow1E9.Length <= LeadingPowers1E9.Length)
1062LeadingPowers1E9.CopyTo(pow1E9.Slice(0, LeadingPowers1E9.Length));
1067for (int i = 6; i + 1 < Indexes.Length; i++)
1069Debug.Assert(2 * src.Length - (Indexes[i + 1] - Indexes[i]) is 0 or 1);
1070if (pow1E9.Length - toExclusive < (src.Length << 1))
1072Span<uint> dst = pow1E9.Slice(toExclusive, src.Length << 1);
1087if ((uint)index < (uint)Indexes.Length)
1091maxIndex = Indexes.Length - 2;
1115if (trailingZeroCount < UInt32PowersOfTen.Length)
1117BigIntegerCalculator.Multiply(left, UInt32PowersOfTen[trailingZeroCount], bits.Slice(0, left.Length + 1));
1136int curLength = first.Length;
1151Debug.Assert(fi + 1 < Indexes.Length);
1158Span<uint> dst = powersOfTen2.Slice(0, curLength += power.Length);
1160if (power.Length < src.Length)
1179Span<uint> bits2 = bits.Slice(omittedLength, curLength += left.Length);
1180if (left.Length < powersOfTen.Length)
1237Debug.Assert(destination.Length * TParser.DigitsPerBlock == input.Length);
1238ref TChar lastWholeBlockStart = ref Unsafe.Add(ref MemoryMarshal.GetReference(input), input.Length - TParser.DigitsPerBlock);
System\Numerics\BigIntegerCalculator.DivRem.cs (120)
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);
691if (left.Length < right.Length)
System\Numerics\BigIntegerCalculator.FastReducer.cs (21)
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)
83if (left.Length < right.Length)
87bits.Slice(0, left.Length + right.Length));
93bits.Slice(0, left.Length + right.Length));
96return ActualLength(bits.Slice(0, left.Length + right.Length));
111if (right.Length > k)
System\Numerics\BigIntegerCalculator.PowMod.cs (33)
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;
76if (leftLength >= right.Length)
170for (int i = 0; i < power.Length - 1; i++)
182return PowCore(value, power[power.Length - 1], modulus, result);
212Debug.Assert(bits.Length == modulus.Length + modulus.Length);
218int size = Math.Max(value.Length, bits.Length);
226valueCopy.Slice(value.Length).Clear();
228if (value.Length > modulus.Length)
230Remainder(value, modulus, valueCopy.Slice(0, value.Length));
261Debug.Assert(bits.Length == modulus.Length + modulus.Length);
266int size = Math.Max(value.Length, bits.Length);
275valueCopy.Slice(value.Length).Clear();
277if (value.Length > modulus.Length)
279Remainder(value, modulus, valueCopy.Slice(0, value.Length));
316if (modulus.Length < ReducerThreshold)
324int size = modulus.Length * 2 + 1;
331size = r.Length - modulus.Length + 1;
338size = modulus.Length * 2 + 2;
376if (modulus.Length < ReducerThreshold)
384int size = modulus.Length * 2 + 1;
391size = r.Length - modulus.Length + 1;
398size = modulus.Length * 2 + 2;
440for (int i = 0; i < power.Length - 1; i++)
456return PowCore(value, valueLength, power[power.Length - 1], modulus, result, resultLength, temp);
499for (int i = 0; i < power.Length - 1; i++)
515return PowCore(value, valueLength, power[power.Length - 1], reducer, result, resultLength, temp);
System\Numerics\BigIntegerCalculator.SquMul.cs (49)
23Debug.Assert(bits.Length == value.Length + value.Length);
34if (value.Length < SquareThreshold)
51for (int i = 0; i < value.Length; i++)
81int n = value.Length >> 1;
98int foldLength = valueHigh.Length + 1;
133Debug.Assert(bits.Length == left.Length + 1);
143for (; i < left.Length; i++)
161Debug.Assert(left.Length >= right.Length);
162Debug.Assert(bits.Length >= left.Length + right.Length);
175if (right.Length < MultiplyKaratsubaThreshold)
207int n = (left.Length + 1) >> 1;
209if (right.Length <= n)
214Debug.Assert(leftLow.Length >= leftHigh.Length);
217Span<uint> bitsLow = bits.Slice(0, n + right.Length);
223int carryLength = right.Length;
229Span<uint> carryOrig = bits.Slice(n, right.Length);
234if (leftHigh.Length < right.Length)
235MultiplyKaratsuba(right, leftHigh, bitsHigh.Slice(0, leftHigh.Length + right.Length), (right.Length + 1) >> 1);
237Multiply(leftHigh, right, bitsHigh.Slice(0, leftHigh.Length + right.Length));
249Debug.Assert(left.Length >= right.Length);
250Debug.Assert(2 * n - left.Length is 0 or 1);
251Debug.Assert(right.Length > n);
252Debug.Assert(bits.Length >= left.Length + right.Length);
254if (right.Length < MultiplyKaratsubaThreshold)
272Debug.Assert(leftLow.Length >= leftHigh.Length);
273Debug.Assert(rightLow.Length >= rightHigh.Length);
277MultiplyKaratsuba(leftLow, rightLow, bitsLow, (leftLow.Length + 1) >> 1);
320Debug.Assert(ActualLength(core) <= left.Length + 1);
333Debug.Assert(right.Length < MultiplyKaratsubaThreshold);
346for (int i = 0; i < right.Length; i++)
350for (int j = 0; j < left.Length; j++)
357Unsafe.Add(ref resultPtr, i + left.Length) = (uint)carry;
364Debug.Assert(left.Length >= right.Length);
365Debug.Assert(core.Length >= left.Length);
382for (; i < right.Length; i++)
389for (; i < left.Length; i++)
System.Security.Cryptography (618)
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\AlgorithmIdentifierAsn.manual.cs (1)
49if (span.Length != 2)
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)
210decoded.SerialNumber = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
218decoded.Issuer = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
226decoded.Subject = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
234decoded.IssuerUniqueId = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
249decoded.SubjectUniqueId = rebindSpan.Overlaps(tmpSpan, out offset) ? rebind.Slice(offset, tmpSpan.Length) : tmpSpan.ToArray();
System.Security.Cryptography.Cose (17)
System.Security.Cryptography.Pkcs (138)
src\libraries\Common\src\System\Security\Cryptography\Asn1\AlgorithmIdentifierAsn.manual.cs (1)
49if (span.Length != 2)
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 (885)
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 (149)
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 (57)
System.Web.HttpUtility (18)
System.Windows.Forms (18)
System.Windows.Forms.Design (6)
System.Windows.Forms.Primitives (8)
System.Windows.Forms.Primitives.Tests (1)
System.Windows.Forms.Primitives.TestUtilities (9)
System.Windows.Forms.Primitives.TestUtilities.Tests (2)
System.Windows.Forms.Tests (1)
System.Windows.Forms.UI.IntegrationTests (8)
System.Xaml (7)
Test.Utilities (46)
Text.Analyzers (47)
UIAutomationClientSideProviders (5)
xunit.assert (6)