RecyclableLongList.AddRangeWithKnownCount fixed for cases when both collections are empty.

This commit is contained in:
mlemanczyk committed 2023-07-16 12:14:13 +02:00
1 parent e53d6a134c
commit 10189d0d11
1 file changed
+5
@@ -146,6 +146,11 @@ namespace Recyclable.Collections
Span<T[]> memoryBlocksSpan;
Span<T> blockArraySpan;
long requiredCapacity = copied + requiredAdditionalCapacity;
if (requiredCapacity == 0)
{
return;
}
if (_capacity < requiredCapacity)
{
_capacity = Helpers.Resize(this, _blockSize, _blockSizePow2BitShift, checked((long)BitOperations.RoundUpToPowerOf2((ulong)requiredCapacity)));