Fix Neutral crushing checks.
This commit is contained in:
@@ -18,6 +18,7 @@ namespace OpenRA.Primitives
|
||||
static class LongBitSetAllocator<T> where T : class
|
||||
{
|
||||
static readonly Cache<string, long> Bits = new Cache<string, long>(Allocate);
|
||||
static long allBits = 1;
|
||||
static long nextBits = 1;
|
||||
|
||||
static long Allocate(string value)
|
||||
@@ -25,6 +26,7 @@ namespace OpenRA.Primitives
|
||||
lock (Bits)
|
||||
{
|
||||
var bits = nextBits;
|
||||
allBits |= bits;
|
||||
nextBits <<= 1;
|
||||
|
||||
if (nextBits == 0)
|
||||
@@ -85,6 +87,8 @@ namespace OpenRA.Primitives
|
||||
nextBits = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static long Mask { get { return allBits; } }
|
||||
}
|
||||
|
||||
// Opitmized BitSet to be used only when guaranteed to be no more than 64 values.
|
||||
@@ -114,6 +118,7 @@ namespace OpenRA.Primitives
|
||||
|
||||
public static bool operator ==(LongBitSet<T> me, LongBitSet<T> other) { return me.bits == other.bits; }
|
||||
public static bool operator !=(LongBitSet<T> me, LongBitSet<T> other) { return !(me == other); }
|
||||
public static LongBitSet<T> operator ~(LongBitSet<T> me) { return new LongBitSet<T>(me.bits ^ LongBitSetAllocator<T>.Mask); }
|
||||
|
||||
public bool Equals(LongBitSet<T> other) { return other == this; }
|
||||
public override bool Equals(object obj) { return obj is LongBitSet<T> && Equals((LongBitSet<T>)obj); }
|
||||
|
||||
Reference in New Issue
Block a user