RecyclableList.AddRange(RecyclableList<T> items) fixed to copy items only within block size & skip the rest.
This commit is contained in:
1 parent
625b44d341
commit
9b9b683462
1 file changed
+1
-2
@@ -388,7 +388,7 @@ namespace Recyclable.Collections
|
|||||||
if (targetBlockArraySpan.IsEmpty && copiedCount < itemsCount)
|
if (targetBlockArraySpan.IsEmpty && copiedCount < itemsCount)
|
||||||
{
|
{
|
||||||
targetBlockIndex++;
|
targetBlockIndex++;
|
||||||
targetBlockArraySpan = new(targetMemoryBlocksSpan[targetBlockIndex]);
|
targetBlockArraySpan = new(targetMemoryBlocksSpan[targetBlockIndex], 0, blockSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -532,7 +532,6 @@ namespace Recyclable.Collections
|
|||||||
Span<T> blockArraySpan;
|
Span<T> blockArraySpan;
|
||||||
if (source.TryGetNonEnumeratedCount(out var requiredAdditionalCapacity))
|
if (source.TryGetNonEnumeratedCount(out var requiredAdditionalCapacity))
|
||||||
{
|
{
|
||||||
|
|
||||||
int requiredCapacity = targetItemIdx + requiredAdditionalCapacity;
|
int requiredCapacity = targetItemIdx + requiredAdditionalCapacity;
|
||||||
if (capacity < requiredCapacity)
|
if (capacity < requiredCapacity)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user