Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ EnumerateAndRedistributeElements()

void System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.EnumerateAndRedistributeElements ( )
inlineprivate

Definition at line 105 of file HashRepartitionEnumerator.cs.

106 {
107 Mutables mutables = _mutables;
108 ListChunk<Pair<TInputOutput, THashKey>>[] array = new ListChunk<Pair<TInputOutput, THashKey>>[_partitionCount];
109 TInputOutput currentElement = default(TInputOutput);
110 TIgnoreKey currentKey = default(TIgnoreKey);
111 int num = 0;
112 while (_source.MoveNext(ref currentElement, ref currentKey))
113 {
114 if ((num++ & 0x3F) == 0)
115 {
117 }
118 THashKey val = default(THashKey);
119 int num2;
120 if (_keySelector != null)
121 {
122 val = _keySelector(currentElement);
124 }
125 else
126 {
127 num2 = _repartitionStream.GetHashCode(currentElement) % _partitionCount;
128 }
129 ListChunk<Pair<TInputOutput, THashKey>> listChunk = array[num2];
130 if (listChunk == null)
131 {
132 listChunk = (array[num2] = new ListChunk<Pair<TInputOutput, THashKey>>(128));
133 }
134 listChunk.Add(new Pair<TInputOutput, THashKey>(currentElement, val));
135 }
136 for (int i = 0; i < _partitionCount; i++)
137 {
139 }
141 mutables._currentBufferIndex = _partitionIndex;
142 mutables._currentBuffer = array[_partitionIndex];
143 mutables._currentIndex = -1;
144 }
readonly Func< TInputOutput, THashKey > _keySelector
readonly HashRepartitionStream< TInputOutput, THashKey, int > _repartitionStream
readonly QueryOperatorEnumerator< TInputOutput, TIgnoreKey > _source
readonly ListChunk< Pair< TInputOutput, THashKey > >[][] _valueExchangeMatrix
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)

References System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._barrier, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._cancellationToken, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._keySelector, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._mutables, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._partitionCount, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._partitionIndex, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._repartitionStream, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._source, System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >._valueExchangeMatrix, System.Linq.Parallel.ListChunk< TInputOutput >.Add(), System.array, System.Linq.Parallel.HashRepartitionStream< TInputOutput, THashKey, TOrderKey >.GetHashCode(), System.Linq.Parallel.QueryOperatorEnumerator< TElement, TKey >.MoveNext(), System.Threading.CountdownEvent.Signal(), and System.Threading.CancellationToken.ThrowIfCancellationRequested().

Referenced by System.Linq.Parallel.HashRepartitionEnumerator< TInputOutput, THashKey, TIgnoreKey >.MoveNext().