[C#] Use HashCode.Combine() for basic composite types instead of xor

This commit is contained in:
Jaroslav Wegner 2023-09-24 14:51:28 +03:00
parent c12d63556b
commit f1bab5fa51
16 changed files with 16 additions and 16 deletions

View file

@ -723,7 +723,7 @@ namespace Godot
/// <returns>A hash code for this AABB.</returns> /// <returns>A hash code for this AABB.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return _position.GetHashCode() ^ _size.GetHashCode(); return HashCode.Combine(_position, _size);
} }
/// <summary> /// <summary>

View file

@ -1123,7 +1123,7 @@ namespace Godot
/// <returns>A hash code for this basis.</returns> /// <returns>A hash code for this basis.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Row0.GetHashCode() ^ Row1.GetHashCode() ^ Row2.GetHashCode(); return HashCode.Combine(Row0, Row1, Row2);
} }
/// <summary> /// <summary>

View file

@ -1308,7 +1308,7 @@ namespace Godot
/// <returns>A hash code for this color.</returns> /// <returns>A hash code for this color.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return R.GetHashCode() ^ G.GetHashCode() ^ B.GetHashCode() ^ A.GetHashCode(); return HashCode.Combine(R, G, B, A);
} }
/// <summary> /// <summary>

View file

@ -414,7 +414,7 @@ namespace Godot
/// <returns>A hash code for this plane.</returns> /// <returns>A hash code for this plane.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return _normal.GetHashCode() ^ _d.GetHashCode(); return HashCode.Combine(_normal, _d);
} }
/// <summary> /// <summary>

View file

@ -1001,7 +1001,7 @@ namespace Godot
/// <returns>A hash code for this projection.</returns> /// <returns>A hash code for this projection.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode(); return HashCode.Combine(X, Y, Z, W);
} }
/// <summary> /// <summary>

View file

@ -800,7 +800,7 @@ namespace Godot
/// <returns>A hash code for this quaternion.</returns> /// <returns>A hash code for this quaternion.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode(); return HashCode.Combine(X, Y, Z, W);
} }
/// <summary> /// <summary>

View file

@ -459,7 +459,7 @@ namespace Godot
/// <returns>A hash code for this rect.</returns> /// <returns>A hash code for this rect.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return _position.GetHashCode() ^ _size.GetHashCode(); return HashCode.Combine(_position, _size);
} }
/// <summary> /// <summary>

View file

@ -419,7 +419,7 @@ namespace Godot
/// <returns>A hash code for this rect.</returns> /// <returns>A hash code for this rect.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return _position.GetHashCode() ^ _size.GetHashCode(); return HashCode.Combine(_position, _size);
} }
/// <summary> /// <summary>

View file

@ -626,7 +626,7 @@ namespace Godot
/// <returns>A hash code for this transform.</returns> /// <returns>A hash code for this transform.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return X.GetHashCode() ^ Y.GetHashCode() ^ Origin.GetHashCode(); return HashCode.Combine(X, Y, Origin);
} }
/// <summary> /// <summary>

View file

@ -653,7 +653,7 @@ namespace Godot
/// <returns>A hash code for this transform.</returns> /// <returns>A hash code for this transform.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Basis.GetHashCode() ^ Origin.GetHashCode(); return HashCode.Combine(Basis, Origin);
} }
/// <summary> /// <summary>

View file

@ -1000,7 +1000,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode(); return HashCode.Combine(X, Y);
} }
/// <summary> /// <summary>

View file

@ -556,7 +556,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode(); return HashCode.Combine(X, Y);
} }
/// <summary> /// <summary>

View file

@ -1102,7 +1102,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode(); return HashCode.Combine(X, Y, Z);
} }
/// <summary> /// <summary>

View file

@ -611,7 +611,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode(); return HashCode.Combine(X, Y, Z);
} }
/// <summary> /// <summary>

View file

@ -884,7 +884,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode(); return HashCode.Combine(X, Y, Z, W);
} }
/// <summary> /// <summary>

View file

@ -632,7 +632,7 @@ namespace Godot
/// <returns>A hash code for this vector.</returns> /// <returns>A hash code for this vector.</returns>
public override readonly int GetHashCode() public override readonly int GetHashCode()
{ {
return Y.GetHashCode() ^ X.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode(); return HashCode.Combine(X, Y, Z, W);
} }
/// <summary> /// <summary>