Change GetHashCode to be equivalent to System.Drawing.Rectangle

This commit is contained in:
Brandon Thetford
2024-02-20 21:37:24 -07:00
parent 47fad6189d
commit feca713516

View File

@@ -261,7 +261,10 @@ public struct Rectangle
/// <summary>GetHashCode Method</summary>
/// <remarks>Calculates a hashing value.</remarks>
public override int GetHashCode () { return (Height + Width) ^ (X + Y); }
public override int GetHashCode () { return X ^
((Y << 13) | (Y >>> 19)) ^
((Width << 26) | (Width >>> 6)) ^
((Height << 7) | (Height >>> 25)); }
/// <summary>IntersectsWith Method</summary>
/// <remarks>Checks if a Rectangle intersects with this one.</remarks>