1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-18 14:26:42 +00:00
Ryujinx/Ryujinx.Graphics.Shader/Decoders/Register.cs
2020-01-09 02:13:00 +01:00

36 lines
No EOL
924 B
C#

using System;
namespace Ryujinx.Graphics.Shader.Decoders
{
struct Register : IEquatable<Register>
{
public int Index { get; }
public RegisterType Type { get; }
public bool IsRZ => Type == RegisterType.Gpr && Index == RegisterConsts.RegisterZeroIndex;
public bool IsPT => Type == RegisterType.Predicate && Index == RegisterConsts.PredicateTrueIndex;
public Register(int index, RegisterType type)
{
Index = index;
Type = type;
}
public override int GetHashCode()
{
return (ushort)Index | ((ushort)Type << 16);
}
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;
}
}
}