fix: possible hash code collisions on Matrix4x4
This commit is contained in:
		@@ -240,10 +240,15 @@ public readonly struct Matrix4x4(
 | 
			
		||||
    public override bool Equals(object? obj) => obj is Matrix4x4 matrix && this == matrix;
 | 
			
		||||
    public bool Equals(Matrix4x4 other) => this == other;
 | 
			
		||||
 | 
			
		||||
    public override int GetHashCode() => HashCode.Combine(
 | 
			
		||||
        HashCode.Combine(M11, M12, M13, M14, M21, M22, M23, M24),
 | 
			
		||||
        HashCode.Combine(M31, M32, M33, M34, M41, M42, M43, M44)
 | 
			
		||||
    );
 | 
			
		||||
    public override int GetHashCode()
 | 
			
		||||
    {
 | 
			
		||||
        HashCode hashCode = new();
 | 
			
		||||
        hashCode.Add(M11); hashCode.Add(M12); hashCode.Add(M13); hashCode.Add(M14);
 | 
			
		||||
        hashCode.Add(M21); hashCode.Add(M22); hashCode.Add(M23); hashCode.Add(M24);
 | 
			
		||||
        hashCode.Add(M31); hashCode.Add(M32); hashCode.Add(M33); hashCode.Add(M34);
 | 
			
		||||
        hashCode.Add(M41); hashCode.Add(M42); hashCode.Add(M43); hashCode.Add(M44);
 | 
			
		||||
        return hashCode.ToHashCode();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public override string ToString() => $"Matrix4x4({M11}, {M12}, {M13}, {M14},{M21}, {M22}, {M23}, {M24},{M31}, {M32}, {M33}, {M34},{M41}, {M42}, {M43}, {M44})";
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user