Struct FastBitSet32.BitEnumerator
A custom struct enumerator designed to avoid heap allocation (GC) during iteration and use highly optimized bit-twiddling techniques (like TZCNT) to efficiently find only the set bits.
Namespace: Evergine.Common.Collections
Assembly: Evergine.Common.dll
Syntax
public struct FastBitSet32.BitEnumerator
Constructors
BitEnumerator(uint)
Initializes a new instance of the FastBitSet32.BitEnumerator struct.
Declaration
public BitEnumerator(uint bits)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | bits | The initial bits to enumerate. |
Properties
Current
Gets the index of the current set bit.
Declaration
public int Current { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
MoveNext()
Advances the enumerator to the next set bit.
Declaration
public bool MoveNext()
Returns
| Type | Description |
|---|---|
| bool | True if a set bit was found; false if the iteration is complete. |
Reset()
Sets the enumerator to its initial position, which is before the first element in the collection.
Declaration
public void Reset()
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | The collection was modified after the enumerator was created. |
| NotSupportedException | The enumerator does not support being reset. |