aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Cpu/LightningJit/CodeGen/Register.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Cpu/LightningJit/CodeGen/Register.cs')
-rw-r--r--src/Ryujinx.Cpu/LightningJit/CodeGen/Register.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/Ryujinx.Cpu/LightningJit/CodeGen/Register.cs b/src/Ryujinx.Cpu/LightningJit/CodeGen/Register.cs
new file mode 100644
index 00000000..8b96c916
--- /dev/null
+++ b/src/Ryujinx.Cpu/LightningJit/CodeGen/Register.cs
@@ -0,0 +1,42 @@
+using System;
+
+namespace Ryujinx.Cpu.LightningJit.CodeGen
+{
+ readonly struct Register : IEquatable<Register>
+ {
+ public int Index { get; }
+
+ public RegisterType Type { get; }
+
+ public Register(int index, RegisterType type)
+ {
+ Index = index;
+ Type = type;
+ }
+
+ public override int GetHashCode()
+ {
+ return (ushort)Index | ((int)Type << 16);
+ }
+
+ public static bool operator ==(Register x, Register y)
+ {
+ return x.Equals(y);
+ }
+
+ public static bool operator !=(Register x, Register y)
+ {
+ return !x.Equals(y);
+ }
+
+ public override bool Equals(object obj)
+ {
+ return obj is Register reg && Equals(reg);
+ }
+
+ public bool Equals(Register other)
+ {
+ return other.Index == Index && other.Type == Type;
+ }
+ }
+}