RecyclableList.AddRange(RecyclableList<T> items) fixed to copy items only within block size & skip the rest.

This commit is contained in:
Marek Lemańczyk committed 2023-03-11 22:09:36 +01:00
1 parent 625b44d341
commit 9b9b683462
1 file changed
+1 -2
+1 -2
View File
@@ -388,7 +388,7 @@ namespace Recyclable.Collections
if (targetBlockArraySpan.IsEmpty && copiedCount < itemsCount)
{
targetBlockIndex++;
targetBlockArraySpan = new(targetMemoryBlocksSpan[targetBlockIndex]);
targetBlockArraySpan = new(targetMemoryBlocksSpan[targetBlockIndex], 0, blockSize);
}
}
}
@@ -532,7 +532,6 @@ namespace Recyclable.Collections
Span<T> blockArraySpan;
if (source.TryGetNonEnumeratedCount(out var requiredAdditionalCapacity))
{
int requiredCapacity = targetItemIdx + requiredAdditionalCapacity;
if (capacity < requiredCapacity)
{