Merge pull request #82240 from jaros3/vector2i-gethashcode

[C#] Use `HashCode.Combine()` for basic composite types instead of xor
This commit is contained in:
Rémi Verschelde 2023-09-26 13:45:18 +02:00
commit 42011d8673
No known key found for this signature in database
GPG Key ID: C3336907360768E1
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>
public override readonly int GetHashCode()
{
return _position.GetHashCode() ^ _size.GetHashCode();
return HashCode.Combine(_position, _size);
}
/// <summary>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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