Implement IEquatable on the Register struct
This commit is contained in:
parent
ef47ed9007
commit
9d0b070dfd
2 changed files with 12 additions and 9 deletions
|
@ -43,14 +43,14 @@ namespace ChocolArm64.IntermediateRepresentation
|
||||||
return obj is RegisterMask regMask && Equals(regMask);
|
return obj is RegisterMask regMask && Equals(regMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int GetHashCode()
|
|
||||||
{
|
|
||||||
return HashCode.Combine(IntMask, VecMask);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Equals(RegisterMask other)
|
public bool Equals(RegisterMask other)
|
||||||
{
|
{
|
||||||
return IntMask == other.IntMask && VecMask == other.VecMask;
|
return IntMask == other.IntMask && VecMask == other.VecMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override int GetHashCode()
|
||||||
|
{
|
||||||
|
return HashCode.Combine(IntMask, VecMask);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Reflection;
|
||||||
|
|
||||||
namespace ChocolArm64.State
|
namespace ChocolArm64.State
|
||||||
{
|
{
|
||||||
struct Register
|
struct Register : IEquatable<Register>
|
||||||
{
|
{
|
||||||
public int Index;
|
public int Index;
|
||||||
|
|
||||||
|
@ -22,9 +22,12 @@ namespace ChocolArm64.State
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
{
|
{
|
||||||
return obj is Register reg &&
|
return obj is Register reg && Equals(reg);
|
||||||
reg.Index == Index &&
|
}
|
||||||
reg.Type == Type;
|
|
||||||
|
public bool Equals(Register other)
|
||||||
|
{
|
||||||
|
return Index == other.Index && Type == other.Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FieldInfo GetField()
|
public FieldInfo GetField()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue