Register.cs
1 using System; 2 3 namespace Ryujinx.Graphics.Shader.Decoders 4 { 5 readonly struct Register : IEquatable<Register> 6 { 7 public int Index { get; } 8 9 public RegisterType Type { get; } 10 11 public bool IsRZ => Type == RegisterType.Gpr && Index == RegisterConsts.RegisterZeroIndex; 12 public bool IsPT => Type == RegisterType.Predicate && Index == RegisterConsts.PredicateTrueIndex; 13 14 public Register(int index, RegisterType type) 15 { 16 Index = index; 17 Type = type; 18 } 19 20 public override int GetHashCode() 21 { 22 return (ushort)Index | ((ushort)Type << 16); 23 } 24 25 public override bool Equals(object obj) 26 { 27 return obj is Register reg && Equals(reg); 28 } 29 30 public bool Equals(Register other) 31 { 32 return other.Index == Index && 33 other.Type == Type; 34 } 35 } 36 }