RecyclableList.AddRangeEnumerated fixed to update _count before resizing the collection, because RecyclableListHelpers<T>.ResizeAndCopy() relies on it.
This commit is contained in:
1 parent
75ad8227c2
commit
303fb68907
1 file changed
+1
@@ -36,6 +36,7 @@ namespace Recyclable.Collections
|
|||||||
{
|
{
|
||||||
if (targetItemIndex + growByCount > capacity)
|
if (targetItemIndex + growByCount > capacity)
|
||||||
{
|
{
|
||||||
|
_count = targetItemIndex;
|
||||||
capacity = RecyclableListHelpers<T>.ResizeAndCopy(this, checked((int)BitOperations.RoundUpToPowerOf2((uint)(targetItemIndex + growByCount))));
|
capacity = RecyclableListHelpers<T>.ResizeAndCopy(this, checked((int)BitOperations.RoundUpToPowerOf2((uint)(targetItemIndex + growByCount))));
|
||||||
memorySpan = new(_memoryBlock);
|
memorySpan = new(_memoryBlock);
|
||||||
available = capacity - targetItemIndex;
|
available = capacity - targetItemIndex;
|
||||||
|
|||||||
Reference in new issue
Block a user