Add iterators to UnsafeBitSet and SpanBitSet
Introduced `Iterator` structs in `UnsafeBitSet` and `SpanBitSet` to enable efficient traversal of set bits. Added `GetIterator` methods to both structs to return iterator instances. Implemented `NextSetBit` in `SpanBitSet` to support iterator functionality. Changed constants in `UnsafeBitSet` from `private` to `internal` for broader assembly access. Removed redundant methods from `SpanBitSet` to streamline the API in favor of iterator-based operations. Updated constructors in `UnsafeSlotMap` and `UnsafeSparseSet` to conditionally clear arrays based on `AllocationOption.Clear`. Incremented assembly version to 1.2.7 to reflect these updates.
This commit is contained in:
@@ -94,6 +94,12 @@ public unsafe struct UnsafeSparseSet<T> : IUnsafeCollection<T>
|
||||
_reverse = new UnsafeArray<int>(capacity, ref handle, allocationOption);
|
||||
_freeSparse = new UnsafeStack<int>(capacity, ref handle, allocationOption);
|
||||
|
||||
if (!allocationOption.HasFlag(AllocationOption.Clear))
|
||||
{
|
||||
_generations.AsSpan().Clear();
|
||||
_sparse.AsSpan().Clear();
|
||||
}
|
||||
|
||||
_count = 0;
|
||||
_nextId = 0;
|
||||
_capacity = capacity;
|
||||
|
||||
Reference in New Issue
Block a user