Add SparseSet Test
This commit is contained in:
@@ -80,6 +80,7 @@ public unsafe struct UnsafeArray<T> : IUnsafeCollection<T>
|
||||
private AllocationHandle _allocationHandle;
|
||||
|
||||
public readonly int Count => _count;
|
||||
public readonly int Length => _count;
|
||||
|
||||
public readonly ref T this[int index]
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ public unsafe struct UnsafeSlotMap<T> : IUnsafeCollection<T>
|
||||
public Enumerator(UnsafeSlotMap<T>* collection)
|
||||
{
|
||||
_collection = collection;
|
||||
_currentIndex = -1;
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -65,7 +65,7 @@ public unsafe struct UnsafeSlotMap<T> : IUnsafeCollection<T>
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_currentIndex = -1;
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -302,11 +302,13 @@ public unsafe struct UnsafeSlotMap<T> : IUnsafeCollection<T>
|
||||
_validBits.ClearAll();
|
||||
|
||||
_count = 0;
|
||||
|
||||
Add(default, out _);
|
||||
}
|
||||
|
||||
public readonly void* GetUnsafePtr()
|
||||
{
|
||||
return _data.GetUnsafePtr();
|
||||
return (T*)_data.GetUnsafePtr() + 1;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -56,7 +56,7 @@ public unsafe struct UnsafeSparseSet<T> : IUnsafeCollection<T>
|
||||
public Enumerator(UnsafeSparseSet<T>* collection)
|
||||
{
|
||||
_collection = collection;
|
||||
_currentIndex = -1;
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -67,10 +67,10 @@ public unsafe struct UnsafeSparseSet<T> : IUnsafeCollection<T>
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
_currentIndex = -1;
|
||||
_currentIndex = 0;
|
||||
}
|
||||
|
||||
public readonly unsafe void Dispose()
|
||||
public readonly void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -345,6 +345,8 @@ public unsafe struct UnsafeSparseSet<T> : IUnsafeCollection<T>
|
||||
|
||||
_count = 0;
|
||||
_nextId = 0;
|
||||
|
||||
Add(default, out _);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -371,7 +373,7 @@ public unsafe struct UnsafeSparseSet<T> : IUnsafeCollection<T>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly void* GetUnsafePtr()
|
||||
{
|
||||
return _dense.GetUnsafePtr();
|
||||
return (T*)_dense.GetUnsafePtr() + 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user