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

◆ MoveNext() [1/2]

override bool System.Linq.Parallel.PartitionedDataSource< T >.ContiguousChunkLazyEnumerator.MoveNext ( [AllowNull] ref T currentElement,
ref int currentKey )
inlinepackage

Definition at line 321 of file PartitionedDataSource.cs.

322 {
323 Mutables mutables = _mutables;
324 if (mutables == null)
325 {
326 mutables = (_mutables = new Mutables());
327 }
328 T[] chunkBuffer;
329 int num;
330 while (true)
331 {
332 chunkBuffer = mutables._chunkBuffer;
333 num = ++mutables._currentChunkIndex;
334 if (num < mutables._currentChunkSize)
335 {
336 break;
337 }
339 {
340 int i = 0;
342 {
343 return false;
344 }
345 try
346 {
347 for (; i < mutables._nextChunkMaxSize; i++)
348 {
349 if (!_source.MoveNext())
350 {
351 break;
352 }
354 }
355 }
356 catch
357 {
358 _exceptionTracker.Value = true;
359 throw;
360 }
361 mutables._currentChunkSize = i;
362 if (i == 0)
363 {
364 return false;
365 }
366 mutables._chunkBaseIndex = _currentIndex.Value;
367 checked
368 {
369 _currentIndex.Value += i;
370 }
371 }
372 if (mutables._nextChunkMaxSize < chunkBuffer.Length && (mutables._chunkCounter++ & 7) == 7)
373 {
374 mutables._nextChunkMaxSize *= 2;
375 if (mutables._nextChunkMaxSize > chunkBuffer.Length)
376 {
377 mutables._nextChunkMaxSize = chunkBuffer.Length;
378 }
379 }
380 mutables._currentChunkIndex = -1;
381 }
383 currentKey = mutables._chunkBaseIndex + num;
384 return true;
385 }

References System.Linq.Parallel.PartitionedDataSource< T >.ContiguousChunkLazyEnumerator._currentIndex, System.Linq.Parallel.PartitionedDataSource< T >.ContiguousChunkLazyEnumerator._exceptionTracker, System.Linq.Parallel.PartitionedDataSource< T >.ContiguousChunkLazyEnumerator._mutables, System.Linq.Parallel.PartitionedDataSource< T >.ContiguousChunkLazyEnumerator._source, System.Linq.Parallel.PartitionedDataSource< T >.ContiguousChunkLazyEnumerator._sourceSyncLock, System.Collections.Generic.IEnumerator< out T >.Current, and System.Linq.Parallel.Shared< T >.Value.