Fixed problem in RecyclableList.Helpers & RecyclableList causing an exception trying to copy too many items into the destination.
This commit is contained in:
1 parent
64002fc443
commit
1540d8e286
2 files changed
+3
-3
No files matched your search
@@ -237,7 +237,7 @@ namespace Recyclable.Collections
|
||||
: RecyclableArrayPool<T>.Rent(list._capacity);
|
||||
|
||||
// & WAS SLOWER WITHOUT
|
||||
new Span<T>(oldMemoryBlock).CopyTo(list._memoryBlock);
|
||||
new Span<T>(oldMemoryBlock, 0, list._count).CopyTo(list._memoryBlock);
|
||||
|
||||
if (oldMemoryBlock.Length >= RecyclableDefaults.MinPooledArrayLength)
|
||||
{
|
||||
@@ -266,7 +266,7 @@ namespace Recyclable.Collections
|
||||
T[] oldMemoryBlock = sourceList._memoryBlock;
|
||||
|
||||
// & WAS SLOWER AS ARRAY
|
||||
new Span<T>(oldMemoryBlock).CopyTo(newMemoryBlock);
|
||||
new Span<T>(oldMemoryBlock, 0, sourceList._count).CopyTo(newMemoryBlock);
|
||||
|
||||
if (oldMemoryBlock.Length >= RecyclableDefaults.MinPooledArrayLength)
|
||||
{
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace Recyclable.Collections
|
||||
_ = RecyclableListHelpers<T>.EnsureCapacity(this, targetCapacity);
|
||||
}
|
||||
|
||||
new Span<T>(items._memoryBlock).CopyTo(new Span<T>(_memoryBlock, _count, items._count));
|
||||
new Span<T>(items._memoryBlock, 0, items._count).CopyTo(new Span<T>(_memoryBlock, _count, items._count));
|
||||
_count = targetCapacity;
|
||||
_version++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user