Tiny cleanup. Order in file of RemoveBlock fixed.
This commit is contained in:
1 parent
ec7835715c
commit
b334d8f19c
1 file changed
+22
-22
@@ -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++;
|
||||
|
||||
Reference in new issue
Block a user