Also implemented on the Bits<T> struct.
This commit is contained in:
@@ -48,7 +48,7 @@ namespace OpenRA.Primitives
|
||||
}
|
||||
}
|
||||
|
||||
public struct Bits<T> where T : struct
|
||||
public struct Bits<T> : IEquatable<Bits<T>> where T : struct
|
||||
{
|
||||
public int Value;
|
||||
|
||||
@@ -60,6 +60,11 @@ namespace OpenRA.Primitives
|
||||
return BitAllocator<T>.GetStrings(Value).JoinWith(",");
|
||||
}
|
||||
|
||||
public static bool operator ==(Bits<T> me, Bits<T> other) { return (me.Value == other.Value); }
|
||||
public static bool operator !=(Bits<T> me, Bits<T> other) { return !(me == other); }
|
||||
|
||||
public bool Equals(Bits<T> other) { return other == this; }
|
||||
public override bool Equals(object obj) { return obj is Bits<T> && Equals((Bits<T>)obj); }
|
||||
public override int GetHashCode() { return Value.GetHashCode(); }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user