src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ArraySortHelper.cs (44)
125if (keys.Length > 1)
127IntroSort(keys, 2 * (BitOperations.Log2((uint)keys.Length) + 1), comparer);
140int partitionSize = keys.Length;
181Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold);
184int hi = keys.Length - 1;
222int n = keys.Length;
260for (int i = 0; i < keys.Length - 1; i++)
289if (keys.Length > 1)
299if (nanLeft == keys.Length)
306IntroSort(keys, 2 * (BitOperations.Log2((uint)keys.Length) + 1));
416int partitionSize = keys.Length;
460Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold);
464ref T lastRef = ref Unsafe.Add(ref zeroRef, keys.Length - 1);
465ref T middleRef = ref Unsafe.Add(ref zeroRef, (keys.Length - 1) >> 1);
471ref T nextToLastRef = ref Unsafe.Add(ref zeroRef, keys.Length - 2);
512int n = keys.Length;
548for (int i = 0; i < keys.Length - 1; i++)
637Debug.Assert(0 <= i && i < keys.Length && i < values.Length);
638Debug.Assert(0 <= j && j < keys.Length && j < values.Length);
670Debug.Assert(keys.Length == values.Length);
672if (keys.Length > 1)
674IntroSort(keys, values, 2 * (BitOperations.Log2((uint)keys.Length) + 1), comparer);
681Debug.Assert(values.Length == keys.Length);
685int partitionSize = keys.Length;
726Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold);
729int hi = keys.Length - 1;
767int n = keys.Length;
811for (int i = 0; i < keys.Length - 1; i++)
841if (keys.Length > 1)
851if (nanLeft == keys.Length)
859IntroSort(keys, values, 2 * (BitOperations.Log2((uint)keys.Length) + 1));
911Debug.Assert(values.Length == keys.Length);
914int partitionSize = keys.Length;
955Debug.Assert(keys.Length >= Array.IntrosortSizeThreshold);
957int hi = keys.Length - 1;
1002int n = keys.Length;
1042for (int i = 0; i < keys.Length - 1; i++)
1118for (int i = 0; i < keys.Length; i++)
1128if ((uint)i < (uint)values.Length) // check to see if we have values
src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Icu.cs (7)
786actualSortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pDest, destination.Length, options);
792if ((uint)actualSortKeyLength > (uint)destination.Length)
794if (actualSortKeyLength > destination.Length)
908sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
912if (sortKeyLength > sortKey.Length) // slow path for big strings
931sortKeyLength = Interop.Globalization.GetSortKey(_sortHandle, pSource, source.Length, pSortKey, sortKey.Length, options);
937if (sortKeyLength == 0 || sortKeyLength > sortKey.Length) // internal error (0) or a bug (2nd call failed) in ucol_getSortKey
src\libraries\System.Private.CoreLib\src\System\MemoryExtensions.cs (67)
327span.Length);
334span.Length);
341span.Length);
348span.Length);
352return SpanHelpers.Contains(ref MemoryMarshal.GetReference(span), value, span.Length);
627span.Length);
633span.Length);
639span.Length);
645span.Length);
648return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
664span.Length,
671span.Length,
676return SpanHelpers.IndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
694span.Length);
701span.Length);
708span.Length);
715span.Length);
719return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), value, span.Length);
736span.Length,
744span.Length,
750return SpanHelpers.LastIndexOf(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(value), value.Length);
1651int length = span.Length;
1678span.Length,
1685span.Length,
1689return SpanHelpers.SequenceCompareTo(ref MemoryMarshal.GetReference(span), span.Length, ref MemoryMarshal.GetReference(other), other.Length);
1849span.Length);
1857span.Length);
1861return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
1883span.Length);
1892span.Length);
1896return SpanHelpers.IndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
2155span.Length);
2163span.Length);
2167return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, span.Length);
2189span.Length);
2198span.Length);
2202return SpanHelpers.LastIndexOfAny(ref MemoryMarshal.GetReference(span), value0, value1, value2, span.Length);
2542return valueLength <= span.Length &&
2549return valueLength <= span.Length && SpanHelpers.SequenceEqual(ref MemoryMarshal.GetReference(span), ref MemoryMarshal.GetReference(value), valueLength);
2579int spanLength = span.Length;
2627if (span.Length > 1)
2629SpanHelpers.Reverse(ref MemoryMarshal.GetReference(span), (nuint)span.Length);
3091/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>.
3115/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>.
3141/// no larger element, the bitwise complement of <see cref="Span{T}.Length"/>.
3265if (span.Length > 1)
3283if (span.Length > 1)
3330if (keys.Length != items.Length)
3333if (keys.Length > 1)
3356if (keys.Length != items.Length)
3359if (keys.Length > 1)
3375nuint length = (uint)span.Length;
3449if (length > (uint)destination.Length)
3460(nuint)byteOffset > (nuint)(-((nint)destination.Length * sizeof(T)))))
3747if (separators.IsEmpty && destination.Length > source.Length)
3788if (separators.IsEmpty && destination.Length > source.Length)
3835if (destination.Length == 1)
3879Span<Range> destinationMinusOne = destination.Slice(0, destination.Length - 1);
3880while (separatorIndex < separatorList.Length && (rangeCount < destinationMinusOne.Length || !keepEmptyEntries))
3903if ((uint)rangeCount >= (uint)destinationMinusOne.Length)
3922if ((uint)rangeCount < (uint)destination.Length)
4278_success = shouldAppend = destination.Length >= literalLength;
4294_success = shouldAppend = destination.Length >= literalLength;
4503if (alignment <= _destination.Length - _pos)
4623if (paddingNeeded <= _destination.Length - _pos)
src\libraries\System.Private.CoreLib\src\System\Text\ASCIIEncoding.cs (8)
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);
423return originalBytesLength - bytes.Length; // total number of bytes written
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);
711return originalCharsLength - chars.Length; // total number of chars written
src\libraries\System.Private.CoreLib\src\System\Text\Decoder.cs (2)
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 (2)
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\Latin1Encoding.cs (5)
233return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
243int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false);
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\Unicode\Utf8.cs (11)
68outputBytesRemaining: destination.Length,
97if (destination.Length <= 2)
159outputCharsRemaining: destination.Length,
253outputCharsRemaining: destination.Length,
290if (destination.Length < bytesConsumedJustNow)
375_success = shouldAppend = destination.Length >= literalLength; // UTF8 encoding never produces fewer bytes than input characters
391_success = shouldAppend = destination.Length >= literalLength; // UTF8 encoding never produces fewer bytes than input characters
409ref MemoryMarshal.GetReference(dest), dest.Length);
680GrowAndAppendFormatted(ref this, value, utf16.Length, out charsWritten, format);
727GrowAndAppendFormatted(ref this, value, utf16.Length, out charsWritten, format);
784if (paddingNeeded <= _destination.Length - _pos)
src\libraries\System.Private.CoreLib\src\System\Text\UTF8Encoding.cs (5)
368return GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length);
378int written = GetBytesCommon(charsPtr, chars.Length, bytesPtr, bytes.Length, throwForDestinationOverflow: false);
563return GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length);
573int written = GetCharsCommon(bytesPtr, bytes.Length, charsPtr, chars.Length, throwForDestinationOverflow: false);
661return originalCharsLength - chars.Length; // total number of chars written
src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.EVP.cs (5)
84destination.Length);
89return EvpDigestFinalXOF(ctx, destination, (uint)destination.Length);
94return EvpDigestCurrentXOF(ctx, destination, (uint)destination.Length);
99return EvpDigestXOFOneShot(type, source, source.Length, destination, (uint)destination.Length);
104int ret = EvpDigestSqueeze(ctx, destination, (uint)destination.Length, out bool haveFeature);
src\libraries\Common\src\System\Security\Cryptography\RsaPaddingProcessor.cs (22)
125int k = destination.Length;
134Span<byte> mInEM = destination.Slice(destination.Length - source.Length);
135Span<byte> ps = destination.Slice(2, destination.Length - source.Length - 3);
138destination[ps.Length + 2] = 0;
157int spaceRemain = destination.Length - len;
161len = Choose(spaceRemainSign, destination.Length, len);
271if (destination.Length - 11 < tLen)
277int paddingLength = destination.Length - tLen - 3;
303int maxInput = checked(destination.Length - hLen - hLen - 2);
325Span<byte> mDest = db.Slice(db.Length - source.Length);
326Span<byte> ps = db.Slice(hLen, db.Length - hLen - 1 - mDest.Length);
327Span<byte> psEnd = db.Slice(hLen + ps.Length, 1);
349dbMask = CryptoPool.Rent(db.Length);
350dbMaskSpan = new Span<byte>(dbMask, 0, db.Length);
409destination.Slice(0, destination.Length - emLen).Clear();
412Span<byte> em = destination.Slice(destination.Length - emLen, emLen);
555ReadOnlySpan<byte> salt = dbMask.Slice(dbMask.Length - sLen);
592while (writePtr.Length > 0)
598if (writePtr.Length >= hLen)
620tmp.Slice(0, writePtr.Length).CopyTo(writePtr);
633if (a.Length != b.Length)
System\Security\Cryptography\RandomNumberGenerator.cs (18)
59byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
62GetBytes(array, 0, data.Length);
63new ReadOnlySpan<byte>(array, 0, data.Length).CopyTo(data);
67Array.Clear(array, 0, data.Length);
82byte[] array = ArrayPool<byte>.Shared.Rent(data.Length);
89new ReadOnlySpan<byte>(array, 0, data.Length).CopyTo(data);
93Array.Clear(array, 0, data.Length);
296int n = values.Length;
321int needed = (destination.Length + 1) / 2;
326if (destination.Length % 2 != 0)
338needed = destination.Length / 2;
347destination = destination.Slice(remainingRandom.Length * 2);
368if (destination.Length < randomBytes.Length)
370randomBytes = randomBytes.Slice(0, destination.Length);
376for (int i = 0; i < randomBytes.Length; i++)
381destination = destination.Slice(randomBytes.Length);
389for (int i = 0; i < destination.Length; i++)