Tiny cleanup. Order in file of RemoveBlock fixed.

This commit is contained in:
mlemanczyk committed 2023-09-16 21:41:38 +02:00
1 parent ec7835715c
commit b334d8f19c
1 file changed
+22 -22
+22 -22
View File
@@ -549,28 +549,6 @@ namespace Recyclable.Collections
return false;
}
public void RemoveBlock(int index)
{
if (_blockSize >= RecyclableDefaults.MinPooledArrayLength)
{
RecyclableArrayPool<T>.ReturnShared(_memoryBlocks[index], _needsClearing);
}
_memoryBlocks[index] = null;
_capacity -= _blockSize;
if (_nextItemBlockIndex == index)
{
_nextItemIndex = 0;
}
else if (_nextItemBlockIndex > index)
{
_nextItemBlockIndex--;
}
_lastBlockWithData--;
_version++;
}
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
public void RemoveAt(int index)
{
@@ -647,6 +625,28 @@ namespace Recyclable.Collections
_version++;
}
public void RemoveBlock(int index)
{
if (_blockSize >= RecyclableDefaults.MinPooledArrayLength)
{
RecyclableArrayPool<T>.ReturnShared(_memoryBlocks[index], _needsClearing);
}
_memoryBlocks[index] = null;
_capacity -= _blockSize;
if (_nextItemBlockIndex == index)
{
_nextItemIndex = 0;
}
else if (_nextItemBlockIndex > index)
{
_nextItemBlockIndex--;
}
_lastBlockWithData--;
_version++;
}
public void Dispose()
{
_version++;