Use exact component value equality checks in equality comparisons
(cherry picked from commit 2cddf3de97943844512b2d84aa6be122c6f0d409)
This commit is contained in:
@@ -1464,7 +1464,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator ==(Double2 left, Double2 right)
|
||||
{
|
||||
return Mathd.NearEqual(left.X, right.X) && Mathd.NearEqual(left.Y, right.Y);
|
||||
return left.Equals(ref right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1476,7 +1476,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool operator !=(Double2 left, Double2 right)
|
||||
{
|
||||
return !Mathd.NearEqual(left.X, right.X) || !Mathd.NearEqual(left.Y, right.Y);
|
||||
return !left.Equals(ref right);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1582,7 +1582,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(ref Double2 other)
|
||||
{
|
||||
return Mathd.NearEqual(other.X, X) && Mathd.NearEqual(other.Y, Y);
|
||||
return X == other.X && Y == other.Y;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1590,7 +1590,7 @@ namespace FlaxEngine
|
||||
/// </summary>
|
||||
public static bool Equals(ref Double2 a, ref Double2 b)
|
||||
{
|
||||
return Mathd.NearEqual(a.X, b.X) && Mathd.NearEqual(a.Y, b.Y);
|
||||
return a.Equals(ref b);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1601,7 +1601,7 @@ namespace FlaxEngine
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool Equals(Double2 other)
|
||||
{
|
||||
return Mathd.NearEqual(other.X, X) && Mathd.NearEqual(other.Y, Y);
|
||||
return Equals(ref other);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1611,7 +1611,7 @@ namespace FlaxEngine
|
||||
/// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
|
||||
public override bool Equals(object value)
|
||||
{
|
||||
return value is Double2 other && Mathd.NearEqual(other.X, X) && Mathd.NearEqual(other.Y, Y);
|
||||
return value is Double2 other && Equals(ref other);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user