mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-07 20:26:27 +02:00
Move solution and projects to src
This commit is contained in:
parent
cd124bda58
commit
cee7121058
3466 changed files with 55 additions and 55 deletions
74
src/ARMeilleure/CodeGen/RegisterAllocators/LiveRange.cs
Normal file
74
src/ARMeilleure/CodeGen/RegisterAllocators/LiveRange.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using System;
|
||||
|
||||
namespace ARMeilleure.CodeGen.RegisterAllocators
|
||||
{
|
||||
unsafe readonly struct LiveRange : IEquatable<LiveRange>
|
||||
{
|
||||
private struct Data
|
||||
{
|
||||
public int Start;
|
||||
public int End;
|
||||
public LiveRange Next;
|
||||
}
|
||||
|
||||
private readonly Data* _data;
|
||||
|
||||
public ref int Start => ref _data->Start;
|
||||
public ref int End => ref _data->End;
|
||||
public ref LiveRange Next => ref _data->Next;
|
||||
|
||||
public LiveRange(int start, int end, LiveRange next = default)
|
||||
{
|
||||
_data = Allocators.LiveRanges.Allocate<Data>();
|
||||
|
||||
Start = start;
|
||||
End = end;
|
||||
Next = next;
|
||||
}
|
||||
|
||||
public bool Overlaps(int start, int end)
|
||||
{
|
||||
return Start < end && start < End;
|
||||
}
|
||||
|
||||
public bool Overlaps(LiveRange range)
|
||||
{
|
||||
return Start < range.End && range.Start < End;
|
||||
}
|
||||
|
||||
public bool Overlaps(int position)
|
||||
{
|
||||
return position >= Start && position < End;
|
||||
}
|
||||
|
||||
public bool Equals(LiveRange range)
|
||||
{
|
||||
return range._data == _data;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is LiveRange range && Equals(range);
|
||||
}
|
||||
|
||||
public static bool operator ==(LiveRange a, LiveRange b)
|
||||
{
|
||||
return a.Equals(b);
|
||||
}
|
||||
|
||||
public static bool operator !=(LiveRange a, LiveRange b)
|
||||
{
|
||||
return !a.Equals(b);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine((IntPtr)_data);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[{Start}, {End})";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue