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:
2025-12-05 16:36:02 +09:00
parent c152e4383d
commit 4dd5d6f1c6
4 changed files with 92 additions and 10 deletions

View File

@@ -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;