Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RangeEnumerable.cs
Go to the documentation of this file.
2
4
5internal sealed class RangeEnumerable : ParallelQuery<int>, IParallelPartitionable<int>
6{
7 private sealed class RangeEnumerator : QueryOperatorEnumerator<int, int>
8 {
9 private readonly int _from;
10
11 private readonly int _count;
12
13 private readonly int _initialIndex;
14
16
17 internal RangeEnumerator(int from, int count, int initialIndex)
18 {
19 _from = from;
20 _count = count;
22 }
23
24 internal override bool MoveNext(ref int currentElement, ref int currentKey)
25 {
26 if (_currentCount == null)
27 {
28 _currentCount = new Shared<int>(-1);
29 }
30 int num = _currentCount.Value + 1;
31 if (num < _count)
32 {
33 _currentCount.Value = num;
34 currentElement = num + _from;
35 currentKey = num + _initialIndex;
36 return true;
37 }
38 return false;
39 }
40
41 internal override void Reset()
42 {
43 _currentCount = null;
44 }
45 }
46
47 private readonly int _from;
48
49 private readonly int _count;
50
51 internal RangeEnumerable(int from, int count)
53 {
54 _from = from;
55 _count = count;
56 }
57
59 {
60 int num = _count / partitionCount;
62 int num3 = 0;
64 for (int i = 0; i < partitionCount; i++)
65 {
66 int num4 = ((i < num2) ? (num + 1) : num);
68 num3 += num4;
69 }
70 return array;
71 }
72
74 {
76 }
77}
RangeEnumerator(int from, int count, int initialIndex)
override bool MoveNext(ref int currentElement, ref int currentKey)
override IEnumerator< int > GetEnumerator()
QueryOperatorEnumerator< int, int >[] GetPartitions(int partitionCount)