RecyclableList.MemoryBlocks renamed to AsArray.

This commit is contained in:
mlemanczyk committed 2023-04-25 02:03:13 +02:00
1 parent 49682fd733
commit abfe476573
2 files changed
+6 -6

No files matched your search

@@ -66,7 +66,7 @@ namespace Recyclable.Collections.Benchmarks
int blockSize = data.BlockSize;
int nextItemBlockIndex = data.NextItemBlockIndex;
var memoryBlocks = new Span<object[]>(data.MemoryBlocks, 0, data.LastBlockWithData + 1);
var memoryBlocks = new Span<object[]>(data.AsArray, 0, data.LastBlockWithData + 1);
for (var blockIndex = 0; blockIndex < nextItemBlockIndex; blockIndex++)
{
var memoryBlock = new Span<object>(memoryBlocks[blockIndex], 0, blockSize);
@@ -94,7 +94,7 @@ namespace Recyclable.Collections.Benchmarks
int blockSize = data.BlockSize;
int nextItemBlockIndex = data.NextItemBlockIndex;
var memoryBlocks = data.MemoryBlocks;
var memoryBlocks = data.AsArray;
for (var blockIndex = 0; blockIndex < nextItemBlockIndex; blockIndex++)
{
var memoryBlock = memoryBlocks[blockIndex];
@@ -141,7 +141,7 @@ namespace Recyclable.Collections.Benchmarks
int nextItemBlockIndex = data.NextItemBlockIndex;
int itemIndex = 0;
int blockIndex = 0;
var memoryBlocks = data.MemoryBlocks;
var memoryBlocks = data.AsArray;
var memoryBlock = memoryBlocks[0];
while (blockIndex < nextItemBlockIndex)
{
@@ -272,19 +272,19 @@ namespace Recyclable.Collections
for (blockIndex = 0; blockIndex <= lastBlockIndex; blockIndex++)
{
itemsSpan = new(items.MemoryBlocks[blockIndex], 0, sourceBlockSize);
itemsSpan = new(items.AsArray[blockIndex], 0, sourceBlockSize);
itemsSpan.CopyTo(targetSpan);
targetSpan = targetSpan[sourceBlockSize..];
}
if (blockIndex == 0)
{
itemsSpan = new(items.MemoryBlocks[blockIndex], 0, (int)sourceItemsCount);
itemsSpan = new(items.AsArray[blockIndex], 0, (int)sourceItemsCount);
itemsSpan.CopyTo(targetSpan);
}
else if (blockIndex <= items.LastTakenBlockIndex)
{
itemsSpan = new(items.MemoryBlocks[blockIndex], 0, items.NextItemIndex);
itemsSpan = new(items.AsArray[blockIndex], 0, items.NextItemIndex);
itemsSpan.CopyTo(targetSpan);
}