mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-06-29 08:46:24 +02:00
parent
417df486b1
commit
361d0c5632
622 changed files with 3080 additions and 2652 deletions
|
@ -122,7 +122,7 @@ namespace Ryujinx.Common.Collections
|
|||
/// </summary>
|
||||
/// <param name="node">The node to search for RangeNodes within</param>
|
||||
/// <param name="list">The list to add RangeNodes to</param>
|
||||
private void AddToList(IntervalTreeNode<TKey, TValue> node, List<RangeNode<TKey, TValue>> list)
|
||||
private static void AddToList(IntervalTreeNode<TKey, TValue> node, List<RangeNode<TKey, TValue>> list)
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
|
@ -163,6 +163,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -173,7 +174,7 @@ namespace Ryujinx.Common.Collections
|
|||
/// <param name="end">End of the range</param>
|
||||
/// <param name="overlaps">Overlaps array to place results in</param>
|
||||
/// <param name="overlapCount">Overlaps count to update</param>
|
||||
private void GetValues(IntervalTreeNode<TKey, TValue> node, TKey start, TKey end, ref TValue[] overlaps, ref int overlapCount)
|
||||
private static void GetValues(IntervalTreeNode<TKey, TValue> node, TKey start, TKey end, ref TValue[] overlaps, ref int overlapCount)
|
||||
{
|
||||
if (node == null || start.CompareTo(node.Max) >= 0)
|
||||
{
|
||||
|
@ -313,6 +314,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
IntervalTreeNode<TKey, TValue> newNode = new(start, end, value, parent);
|
||||
if (newNode.Parent == null)
|
||||
{
|
||||
|
|
|
@ -64,6 +64,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -112,6 +113,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
newNode.Parent = parent;
|
||||
if (parent == null)
|
||||
{
|
||||
|
@ -125,6 +127,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
parent.Right = newNode;
|
||||
}
|
||||
|
||||
Count++;
|
||||
return newNode;
|
||||
}
|
||||
|
@ -274,6 +277,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,12 +39,14 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
return Minimum(node.Right);
|
||||
}
|
||||
|
||||
T parent = node.Parent;
|
||||
while (parent != null && node == parent.Right)
|
||||
{
|
||||
node = parent;
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -59,12 +61,14 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
return Maximum(node.Left);
|
||||
}
|
||||
|
||||
T parent = node.Parent;
|
||||
while (parent != null && node == parent.Left)
|
||||
{
|
||||
node = parent;
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
@ -120,6 +124,7 @@ namespace Ryujinx.Common.Collections
|
|||
RotateLeft(ParentOf(ptr));
|
||||
sibling = RightOf(ParentOf(ptr));
|
||||
}
|
||||
|
||||
if (ColorOf(LeftOf(sibling)) == Black && ColorOf(RightOf(sibling)) == Black)
|
||||
{
|
||||
SetColor(sibling, Red);
|
||||
|
@ -134,6 +139,7 @@ namespace Ryujinx.Common.Collections
|
|||
RotateRight(sibling);
|
||||
sibling = RightOf(ParentOf(ptr));
|
||||
}
|
||||
|
||||
SetColor(sibling, ColorOf(ParentOf(ptr)));
|
||||
SetColor(ParentOf(ptr), Black);
|
||||
SetColor(RightOf(sibling), Black);
|
||||
|
@ -152,6 +158,7 @@ namespace Ryujinx.Common.Collections
|
|||
RotateRight(ParentOf(ptr));
|
||||
sibling = LeftOf(ParentOf(ptr));
|
||||
}
|
||||
|
||||
if (ColorOf(RightOf(sibling)) == Black && ColorOf(LeftOf(sibling)) == Black)
|
||||
{
|
||||
SetColor(sibling, Red);
|
||||
|
@ -166,6 +173,7 @@ namespace Ryujinx.Common.Collections
|
|||
RotateLeft(sibling);
|
||||
sibling = LeftOf(ParentOf(ptr));
|
||||
}
|
||||
|
||||
SetColor(sibling, ColorOf(ParentOf(ptr)));
|
||||
SetColor(ParentOf(ptr), Black);
|
||||
SetColor(LeftOf(sibling), Black);
|
||||
|
@ -174,6 +182,7 @@ namespace Ryujinx.Common.Collections
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetColor(ptr, Black);
|
||||
}
|
||||
|
||||
|
@ -200,6 +209,7 @@ namespace Ryujinx.Common.Collections
|
|||
balanceNode = ParentOf(balanceNode);
|
||||
RotateLeft(balanceNode);
|
||||
}
|
||||
|
||||
SetColor(ParentOf(balanceNode), Black);
|
||||
SetColor(ParentOf(ParentOf(balanceNode)), Red);
|
||||
RotateRight(ParentOf(ParentOf(balanceNode)));
|
||||
|
@ -223,12 +233,14 @@ namespace Ryujinx.Common.Collections
|
|||
balanceNode = ParentOf(balanceNode);
|
||||
RotateRight(balanceNode);
|
||||
}
|
||||
|
||||
SetColor(ParentOf(balanceNode), Black);
|
||||
SetColor(ParentOf(ParentOf(balanceNode)), Red);
|
||||
RotateLeft(ParentOf(ParentOf(balanceNode)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetColor(Root, Black);
|
||||
}
|
||||
|
||||
|
@ -242,6 +254,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
node.Right.Parent = node;
|
||||
}
|
||||
|
||||
T nodeParent = ParentOf(node);
|
||||
right.Parent = nodeParent;
|
||||
if (nodeParent == null)
|
||||
|
@ -256,6 +269,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
nodeParent.Right = right;
|
||||
}
|
||||
|
||||
right.Left = node;
|
||||
node.Parent = right;
|
||||
}
|
||||
|
@ -271,6 +285,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
node.Left.Parent = node;
|
||||
}
|
||||
|
||||
T nodeParent = ParentOf(node);
|
||||
left.Parent = nodeParent;
|
||||
if (nodeParent == null)
|
||||
|
@ -285,6 +300,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
nodeParent.Left = left;
|
||||
}
|
||||
|
||||
left.Right = node;
|
||||
node.Parent = left;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
return node.Key;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
@ -94,6 +95,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
return node.Key;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
@ -111,6 +113,7 @@ namespace Ryujinx.Common.Collections
|
|||
|
||||
return successor != null ? successor.Key : default;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
@ -128,6 +131,7 @@ namespace Ryujinx.Common.Collections
|
|||
|
||||
return predecessor != null ? predecessor.Key : default;
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
|
@ -147,6 +151,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
nodes.Enqueue(this.Root);
|
||||
}
|
||||
|
||||
while (nodes.TryDequeue(out Node<TKey, TValue> node))
|
||||
{
|
||||
list.Add(new KeyValuePair<TKey, TValue>(node.Key, node.Value));
|
||||
|
@ -154,11 +159,13 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
nodes.Enqueue(node.Left);
|
||||
}
|
||||
|
||||
if (node.Right != null)
|
||||
{
|
||||
nodes.Enqueue(node.Right);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -184,7 +191,7 @@ namespace Ryujinx.Common.Collections
|
|||
/// </summary>
|
||||
/// <param name="node">The node to search for nodes within</param>
|
||||
/// <param name="list">The list to add node to</param>
|
||||
private void AddToList(Node<TKey, TValue> node, List<KeyValuePair<TKey, TValue>> list)
|
||||
private static void AddToList(Node<TKey, TValue> node, List<KeyValuePair<TKey, TValue>> list)
|
||||
{
|
||||
if (node == null)
|
||||
{
|
||||
|
@ -225,6 +232,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -274,6 +282,7 @@ namespace Ryujinx.Common.Collections
|
|||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
Node<TKey, TValue> newNode = new(key, value, parent);
|
||||
if (newNode.Parent == null)
|
||||
{
|
||||
|
@ -287,6 +296,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
parent.Right = newNode;
|
||||
}
|
||||
|
||||
Count++;
|
||||
return newNode;
|
||||
}
|
||||
|
@ -392,6 +402,7 @@ namespace Ryujinx.Common.Collections
|
|||
ptr = parent;
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
@ -400,6 +411,7 @@ namespace Ryujinx.Common.Collections
|
|||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -444,6 +456,7 @@ namespace Ryujinx.Common.Collections
|
|||
ptr = parent;
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
return parent;
|
||||
}
|
||||
}
|
||||
|
@ -452,6 +465,7 @@ namespace Ryujinx.Common.Collections
|
|||
return tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -502,6 +516,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
return node.Key.Equals(item.Key) && node.Value.Equals(item.Value);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -588,6 +603,7 @@ namespace Ryujinx.Common.Collections
|
|||
{
|
||||
queue.Enqueue(node.Left);
|
||||
}
|
||||
|
||||
if (null != node.Right)
|
||||
{
|
||||
queue.Enqueue(node.Right);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue