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

◆ EnumerateAndRedistributeElements()

void System.Linq.Parallel.OrderedHashRepartitionEnumerator< TInputOutput, THashKey, TOrderKey >.EnumerateAndRedistributeElements ( )
inlineprivate

Definition at line 113 of file OrderedHashRepartitionEnumerator.cs.

114 {
115 Mutables mutables = _mutables;
116 ListChunk<Pair<TInputOutput, THashKey>>[] array = new ListChunk<Pair<TInputOutput, THashKey>>[_partitionCount];
117 ListChunk<TOrderKey>[] array2 = new ListChunk<TOrderKey>[_partitionCount];
118 TInputOutput currentElement = default(TInputOutput);
119 TOrderKey currentKey = default(TOrderKey);
120 int num = 0;
121 while (_source.MoveNext(ref currentElement, ref currentKey))
122 {
123 if ((num++ & 0x3F) == 0)
124 {
126 }
127 THashKey val = default(THashKey);
128 int num2;
129 if (_keySelector != null)
130 {
131 val = _keySelector(currentElement);
132 num2 = _repartitionStream.GetHashCode(val) % _partitionCount;
133 }
134 else
135 {
136 num2 = _repartitionStream.GetHashCode(currentElement) % _partitionCount;
137 }
138 ListChunk<Pair<TInputOutput, THashKey>> listChunk = array[num2];
139 ListChunk<TOrderKey> listChunk2 = array2[num2];
140 if (listChunk == null)
141 {
142 listChunk = (array[num2] = new ListChunk<Pair<TInputOutput, THashKey>>(128));
143 listChunk2 = (array2[num2] = new ListChunk<TOrderKey>(128));
144 }
145 listChunk.Add(new Pair<TInputOutput, THashKey>(currentElement, val));
146 listChunk2.Add(currentKey);
147 }
148 for (int i = 0; i < _partitionCount; i++)
149 {
152 }
154 mutables._currentBufferIndex = _partitionIndex;
155 mutables._currentBuffer = array[_partitionIndex];
156 mutables._currentKeyBuffer = array2[_partitionIndex];
157 mutables._currentIndex = -1;
158 }
readonly QueryOperatorEnumerator< TInputOutput, TOrderKey > _source
readonly ListChunk< Pair< TInputOutput, THashKey > >[][] _valueExchangeMatrix
readonly HashRepartitionStream< TInputOutput, THashKey, TOrderKey > _repartitionStream
bool MoveNext([MaybeNullWhen(false)][AllowNull] ref TElement currentElement, [AllowNull] ref TKey currentKey)

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

Referenced by System.Linq.Parallel.OrderedHashRepartitionEnumerator< TInputOutput, THashKey, TOrderKey >.MoveNext().