Interface IArchetypeMask<TSelf>
Generic interface for archetype bitsets. Enables JIT specialization via constrained generics:
where TMask : struct, IArchetypeMask<TMask> compiles to direct calls with zero virtual dispatch.
Same pattern as Typhon.Engine.Internals.IPageStore (PersistentStore/TransientStore).
public interface IArchetypeMask<TSelf> where TSelf : struct
Type Parameters
TSelfThe implementing value type itself (curiously-recurring generic pattern), so set operations return the concrete mask type.
Properties
IsEmpty
true when no archetype bits are set.
bool IsEmpty { get; }
Property Value
MaxId
Highest archetype ID this mask can represent.
int MaxId { get; }
Property Value
PopCount
Number of archetypes in the set (count of set bits).
int PopCount { get; }
Property Value
Methods
And(in TSelf)
Set intersection (bitwise AND) — inclusion filtering.
TSelf And(in TSelf other)
Parameters
otherTSelfMask to intersect with.
Returns
- TSelf
A new mask containing only the archetypes present in both.
AndNot(in TSelf)
Set difference (bitwise AND NOT) — exclusion filtering.
TSelf AndNot(in TSelf other)
Parameters
otherTSelfMask whose archetypes are removed from this one.
Returns
- TSelf
A new mask containing the archetypes present in this mask but not in
other.
Clear(ushort)
Removes archetype archetypeId from the set (clears its bit).
void Clear(ushort archetypeId)
Parameters
archetypeIdushortArchetype ID to exclude.
Or(in TSelf)
Set union (bitwise OR).
TSelf Or(in TSelf other)
Parameters
otherTSelfMask to union with.
Returns
- TSelf
A new mask containing every archetype present in either mask.
Set(ushort)
Adds archetype archetypeId to the set (sets its bit).
void Set(ushort archetypeId)
Parameters
Test(ushort)
Tests whether archetype archetypeId is present in the set.
bool Test(ushort archetypeId)
Parameters
archetypeIdushortArchetype ID to test.
Returns
- bool
trueif the bit is set; otherwisefalse.