Failing tests fixed. RecyclableLongList.Insert(int) fixed.

This commit is contained in:
mlemanczyk committed 2023-09-09 19:15:43 +02:00
1 parent 49bcc3801d
commit 8e2885ecd3
1 file changed
+8 -6
+8 -6
View File
@@ -970,17 +970,19 @@ namespace Recyclable.Collections
new Span<T>(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = item;
}
if (_nextItemIndex < _blockSizeMinus1)
if (++_nextItemIndex == _blockSize)
{
if (++_nextItemIndex == 1)
if (_nextItemBlockIndex > _lastBlockWithData)
{
_lastBlockWithData++;
}
}
else
{
_nextItemIndex = 0;
_nextItemBlockIndex++;
_nextItemIndex = 0;
}
else if (_nextItemIndex == 1 && _nextItemBlockIndex > _lastBlockWithData)
{
_lastBlockWithData++;
}
_version++;