32 private SortHelper(
QueryOperatorEnumerator<TInputOutput, TKey> source,
int partitionCount,
int partitionIndex,
QueryTaskGroupState groupState,
int[][]
sharedIndices,
OrdinalIndexState indexState,
IComparer<TKey> keyComparer,
GrowingArray<TKey>[]
sharedkeys,
TInputOutput[][]
sharedValues,
Barrier[][]
sharedBarriers)
64 for (
int i = 0; i <
array2.Length; i++)
66 for (
int j = 0;
j <
array2[i].Length;
j++)
78 array[
k] =
new SortHelper<TInputOutput, TKey>(
partitions[
k],
partitionCount,
k,
groupState,
sharedIndices,
partitions.OrdinalIndexState,
partitions.KeyComparer,
sharedkeys,
sharedValues,
array2);
118 TKey currentKey =
default(TKey);
131 if ((num++ & 0
x3F) == 0)
149 for (
int i = 0; i <
array.Length; i++)
160 for (
int j = 0;
j <
array.Length;
j++)
179 for (
int i = 0; i < num; i++)
181 bool flag = i == num - 1;
248 if (!flag &&
num3 > 0)
301 if (!flag &&
array2.Length != 0)
313 int num = 1 <<
phase;
319 if (right - left > 63)
357 if (
num2 - left <= right - num)
374 while (left < right);
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
void Add(TKey key, TValue value)
CancellationToken MergedCancellationToken
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)
CancellationState CancellationState
int ComputePartnerIndex(int phase)
readonly int _partitionIndex
void BuildKeysFromSource(ref GrowingArray< TKey > keys, ref List< TInputOutput > values)
static SortHelper< TInputOutput, TKey >[] GenerateSortHelpers(PartitionedStream< TInputOutput, TKey > partitions, QueryTaskGroupState groupState)
readonly TInputOutput[][] _sharedValues
readonly int[][] _sharedIndices
override TInputOutput[] Sort()
void QuickSortIndicesInPlace(GrowingArray< TKey > keys, List< TInputOutput > values, OrdinalIndexState ordinalIndexState)
readonly Barrier[][] _sharedBarriers
readonly int _partitionCount
readonly OrdinalIndexState _indexState
readonly QueryOperatorEnumerator< TInputOutput, TKey > _source
SortHelper(QueryOperatorEnumerator< TInputOutput, TKey > source, int partitionCount, int partitionIndex, QueryTaskGroupState groupState, int[][] sharedIndices, OrdinalIndexState indexState, IComparer< TKey > keyComparer, GrowingArray< TKey >[] sharedkeys, TInputOutput[][] sharedValues, Barrier[][] sharedBarriers)
void MergeSortCooperatively()
void QuickSort(int left, int right, TKey[] keys, int[] indices, CancellationToken cancelToken)
readonly IComparer< TKey > _keyComparer
readonly GrowingArray< TKey >[] _sharedKeys
readonly QueryTaskGroupState _groupState
static byte Min(byte val1, byte val2)