Struct SpanBitSet
- Namespace
- Misaki.HighPerformance.LowLevel.Collections
- Assembly
- Misaki.HighPerformance.LowLevel.dll
The SpanBitSet struct represents a non resizable collection of bits. Used to set, check and clear bits on a allocated UnsafeBitSet or on the stack.
public readonly ref struct SpanBitSet : IEquatable<SpanBitSet>
- Implements
- Inherited Members
Constructors
SpanBitSet(Span<uint>)
Initializes a new instance of the UnsafeBitSet class.
public SpanBitSet(Span<uint> bits)
Parameters
Methods
AsSpan()
Creates a Span<T> to access the Misaki.HighPerformance.LowLevel.Collections.SpanBitSet._bits.
public Span<uint> AsSpan()
Returns
AsSpan(Span<uint>, bool)
Copies the bits into a Span<T> and returns a slice containing the copied Misaki.HighPerformance.LowLevel.Collections.SpanBitSet._bits.
public Span<uint> AsSpan(Span<uint> span, bool zero = true)
Parameters
Returns
ClearAll()
Clears all set bits.
public void ClearAll()
ClearBit(int)
Clears the bit at the given index.
public void ClearBit(int index)
Parameters
indexintThe index.
Equals(SpanBitSet)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(SpanBitSet other)
Parameters
otherSpanBitSetAn object to compare with this object.
Returns
GetHashCode()
Returns the hash code for this instance.
public override int GetHashCode()
Returns
- int
A 32-bit signed integer that is the hash code for this instance.
GetIterator()
public SpanBitSet.Iterator GetIterator()
Returns
IsSet(int)
Checks whether a bit is set at the index.
public bool IsSet(int index)
Parameters
indexintThe index.
Returns
- bool
True if it is, otherwise false
NextSetBit(int)
public int NextSetBit(int startIndex)
Parameters
startIndexint
Returns
SetAll()
Sets all bits.
public void SetAll()
SetBit(int)
Sets a bit at the given index. Resizes its internal array if necessary.
public void SetBit(int index)
Parameters
indexintThe index.
ToString()
Returns the fully qualified type name of this instance.
public override string ToString()
Returns
- string
The fully qualified type name.