Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -920,9 +920,7 @@ private Connection Dequeue()
if (FuzzingMode)
{
var swapWith = (ThreadLocalRandom.Current.Next(_queueTail - _queueHead) + _queueHead) & _mask;
var ev = _eventQueue[swapWith];
_eventQueue[swapWith] = _eventQueue[idx];
_eventQueue[idx] = ev;
(_eventQueue[swapWith], _eventQueue[idx]) = (_eventQueue[idx], _eventQueue[swapWith]);
}
var element = _eventQueue[idx];
_eventQueue[idx] = NoEvent;
Expand Down
8 changes: 2 additions & 6 deletions src/core/Akka/Util/Internal/Collections/ListExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ public static List<T> Shuffle<T>(this List<T> @this)
{
int index = r.Next(i);
//swap
var tmp = list[index];
list[index] = list[i];
list[i] = tmp;
(list[index], list[i]) = (list[i], list[index]);
}
return list;
}
Expand All @@ -38,9 +36,7 @@ public static IImmutableList<T> Shuffle<T>(this IImmutableList<T> @this)
{
int index = r.Next(i);
//swap
var tmp = list[index];
list[index] = list[i];
list[i] = tmp;
(list[index], list[i]) = (list[i], list[index]);
}
return list.ToImmutable();
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka/Util/ListPriorityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Enqueue(Envelope item)
{
var pi = (ci - 1) / 2; // parent index
if (_priorityCalculator(_data[ci].Message).CompareTo(_priorityCalculator(_data[pi].Message)) >= 0) break; // child item is larger than (or equal) parent so we're done
var tmp = _data[ci]; _data[ci] = _data[pi]; _data[pi] = tmp;
(_data[ci], _data[pi]) = (_data[pi], _data[ci]);
ci = pi;
}
}
Expand All @@ -77,7 +77,7 @@ public Envelope Dequeue()
if (rc <= li && _priorityCalculator(_data[rc].Message).CompareTo(_priorityCalculator(_data[ci].Message)) < 0) // if there is a rc (ci + 1), and it is smaller than left child, use the rc instead
ci = rc;
if (_priorityCalculator(_data[pi].Message).CompareTo(_priorityCalculator(_data[ci].Message)) <= 0) break; // parent is smaller than (or equal to) smallest child so done
var tmp = _data[pi]; _data[pi] = _data[ci]; _data[ci] = tmp; // swap parent and child
(_data[pi], _data[ci]) = (_data[ci], _data[pi]); // swap parent and child
pi = ci;
}
return frontItem;
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka/Util/StableListPriorityQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void Enqueue(Envelope item)
{
var pi = (ci - 1) / 2; // parent index
if (comparator.Compare(_data[ci], _data[pi]) >= 0) break; // child item is larger than (or equal) parent so we're done
var tmp = _data[ci]; _data[ci] = _data[pi]; _data[pi] = tmp;
(_data[ci], _data[pi]) = (_data[pi], _data[ci]);
ci = pi;
}
}
Expand All @@ -111,7 +111,7 @@ public Envelope Dequeue()
if (rc <= li && comparator.Compare(_data[rc], _data[ci]) < 0) // if there is a rc (ci + 1), and it is smaller than left child, use the rc instead
ci = rc;
if (comparator.Compare(_data[pi], _data[ci]) <= 0) break; // parent is smaller than (or equal to) smallest child so done
var tmp = _data[pi]; _data[pi] = _data[ci]; _data[ci] = tmp; // swap parent and child
(_data[pi], _data[ci]) = (_data[ci], _data[pi]); // swap parent and child
pi = ci;
}
return frontItem.Envelope;
Expand Down
Loading