Table of Contents

Struct ArchetypeMask256

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Compact archetype bitset covering up to 256 archetypes using 4 inline ulongs (32 bytes). Used for Tier 1 query evaluation: a single AND instruction per entity to test archetype membership.

public struct ArchetypeMask256 : IArchetypeMask<ArchetypeMask256>
Implements
Inherited Members

Properties

IsEmpty

True if no bits are set.

public readonly bool IsEmpty { get; }

Property Value

bool

MaxId

Maximum archetype ID supported (255).

public int MaxId { get; }

Property Value

int

PopCount

Number of set bits.

public readonly int PopCount { get; }

Property Value

int

Methods

And(in ArchetypeMask256)

Bitwise AND — inclusion filtering.

public readonly ArchetypeMask256 And(in ArchetypeMask256 other)

Parameters

other ArchetypeMask256

Returns

ArchetypeMask256

AndNot(in ArchetypeMask256)

Bitwise AND NOT — exclusion filtering.

public readonly ArchetypeMask256 AndNot(in ArchetypeMask256 other)

Parameters

other ArchetypeMask256

Returns

ArchetypeMask256

Clear(ushort)

Clear the bit for the given archetype ID.

public void Clear(ushort archetypeId)

Parameters

archetypeId ushort

FromArchetype(ushort)

Create a mask with a single archetype bit set.

public static ArchetypeMask256 FromArchetype(ushort archetypeId)

Parameters

archetypeId ushort

Returns

ArchetypeMask256

FromSubtree(ushort[])

Create a mask with bits set for all archetype IDs in the subtree.

public static ArchetypeMask256 FromSubtree(ushort[] archetypeIds)

Parameters

archetypeIds ushort[]

Returns

ArchetypeMask256

Or(in ArchetypeMask256)

Bitwise OR — union.

public readonly ArchetypeMask256 Or(in ArchetypeMask256 other)

Parameters

other ArchetypeMask256

Returns

ArchetypeMask256

Set(ushort)

Set the bit for the given archetype ID.

public void Set(ushort archetypeId)

Parameters

archetypeId ushort

Test(ushort)

Test whether the given archetype ID is set.

public readonly bool Test(ushort archetypeId)

Parameters

archetypeId ushort

Returns

bool