Also implemented on the Bits<T> struct.

This commit is contained in:
RoosterDragon
2014-05-23 13:49:12 +01:00
parent 67594b844a
commit b1d5f4edd9

View File

@@ -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(); }
}
}