public sealed class BitSetA growable set of bits over 64-bit words: archetype masks, render group masks, dirty flags.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A bool[] would be eight times the memory and would test one flag per instruction. This tests sixty-four, which is what makes "which of these ten thousand nodes changed" a scan the cache can keep up with.
Fields and properties (3)
public int CapacityHow many bits the set currently has room for.
public ReadOnlySpan<ulong> WordsThe backing words, for bulk operations and for uploading a mask to the GPU.
public bool this[int index]Reads or writes one bit. Reading past the end is .
Methods (12)
public BitSet(int bitCapacity = 64)Creates a set with room for bits, all clear.
public void Set(int index)Sets a bit, growing the set if needed.
public void Clear(int index)Clears a bit. Clearing past the end does nothing and does not grow the set.
public void Clear()Clears every bit, keeping the capacity.
public int PopCount()How many bits are set.
public bool IsEmpty()Whether no bit is set.
public bool Contains(BitSet other)Whether every bit set in is also set here.
public bool Intersects(BitSet other)Whether any bit is set in both sets.
public void UnionWith(BitSet other)Sets every bit that is set in .
public void IntersectWith(BitSet other)Clears every bit that is not set in .
public void ExceptWith(BitSet other)Clears every bit that is set in .
public BitSet.Enumerator GetEnumerator()Enumerates the indices of the set bits, ascending. Skips whole empty words, so a sparse set of a million bits costs about as much as the number of bits actually set.
Used by (5)
- ArchetypeVixen.Ecs
- CollectionTestsVixen.Core.Collections.Tests
- EnumeratorVixen.Core.Collections
- QueryDescriptionVixen.Ecs
- SystemAccessVixen.Ecs