0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 08:45:46 +00:00

GetHashCode should not reference mutable fields (#5331)

This commit is contained in:
Marco Carvalho 2023-06-22 13:36:07 -03:00 committed by GitHub
parent 649d372f7d
commit 58907e2c29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 9 deletions

View file

@ -13,8 +13,8 @@ namespace ARMeilleure.State
// _e0 & _e1 could be marked as readonly, however they are not readonly because we modify them through the Unsafe // _e0 & _e1 could be marked as readonly, however they are not readonly because we modify them through the Unsafe
// APIs. This also means that one should be careful when changing the layout of this struct. // APIs. This also means that one should be careful when changing the layout of this struct.
private ulong _e0; private readonly ulong _e0;
private ulong _e1; private readonly ulong _e1;
/// <summary> /// <summary>
/// Gets a new <see cref="V128"/> with all bits set to zero. /// Gets a new <see cref="V128"/> with all bits set to zero.

View file

@ -6,7 +6,7 @@ namespace Ryujinx.HLE.HOS.Services.Mii.Types
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x10)] [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x10)]
struct CreateId : IEquatable<CreateId> struct CreateId : IEquatable<CreateId>
{ {
public UInt128 Raw; public readonly UInt128 Raw;
public bool IsNull => Raw == UInt128.Zero; public bool IsNull => Raw == UInt128.Zero;
public bool IsValid => !IsNull && ((Raw >> 64) & 0xC0) == 0x80; public bool IsValid => !IsNull && ((Raw >> 64) & 0xC0) == 0x80;

View file

@ -4,8 +4,8 @@ namespace Ryujinx.Tests.Unicorn
{ {
public struct SimdValue : IEquatable<SimdValue> public struct SimdValue : IEquatable<SimdValue>
{ {
private ulong _e0; private readonly ulong _e0;
private ulong _e1; private readonly ulong _e1;
public SimdValue(ulong e0, ulong e1) public SimdValue(ulong e0, ulong e1)
{ {

View file

@ -5,7 +5,7 @@ namespace Spv.Generator
{ {
internal struct ConstantKey : IEquatable<ConstantKey> internal struct ConstantKey : IEquatable<ConstantKey>
{ {
private Instruction _constant; private readonly Instruction _constant;
public ConstantKey(Instruction constant) public ConstantKey(Instruction constant)
{ {

View file

@ -5,7 +5,7 @@ namespace Spv.Generator
{ {
internal class DeterministicStringKey : IEquatable<DeterministicStringKey> internal class DeterministicStringKey : IEquatable<DeterministicStringKey>
{ {
private string _value; private readonly string _value;
public DeterministicStringKey(string value) public DeterministicStringKey(string value)
{ {

View file

@ -8,7 +8,7 @@ namespace Spv.Generator
{ {
public OperandType Type => OperandType.String; public OperandType Type => OperandType.String;
private string _value; private readonly string _value;
public LiteralString(string value) public LiteralString(string value)
{ {

View file

@ -5,7 +5,7 @@ namespace Spv.Generator
{ {
internal struct TypeDeclarationKey : IEquatable<TypeDeclarationKey> internal struct TypeDeclarationKey : IEquatable<TypeDeclarationKey>
{ {
private Instruction _typeDeclaration; private readonly Instruction _typeDeclaration;
public TypeDeclarationKey(Instruction typeDeclaration) public TypeDeclarationKey(Instruction typeDeclaration)
{ {