From c923383a7186d33cbacc0839281665447769b2fd Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sun, 29 Jan 2023 21:36:30 +0100 Subject: [PATCH] Tiny code readability improvement --- Recyclable.Collections/RecyclableList.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Recyclable.Collections/RecyclableList.cs b/Recyclable.Collections/RecyclableList.cs index d0b8e28..de708f3 100644 --- a/Recyclable.Collections/RecyclableList.cs +++ b/Recyclable.Collections/RecyclableList.cs @@ -92,10 +92,10 @@ namespace Recyclable.Collections ? new T[localInts[requiredBlockCount]][] : memoryBlocksPool.Rent(localInts[requiredBlockCount]); - var newMemoryBlocksSpan = new Span(newMemoryBlocks); + Span newMemoryBlocksSpan = new(newMemoryBlocks); if (localInts[sourceBlockCount] > 0) { - var sourceSpan = new Span(source); + Span sourceSpan = new(source); sourceSpan.CopyTo(newMemoryBlocksSpan); if (localInts[sourceBlockCount] >= RecyclableDefaults.MinPooledArrayLength) { @@ -266,9 +266,9 @@ namespace Recyclable.Collections int blockSize = _blockSize; int targetItemIdx = (int)(oldLongCount % blockSize); int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0); - var memoryBlocksSpan = new Span(_memoryBlocks); + Span memoryBlocksSpan = new(_memoryBlocks); int memoryBlocksCount = memoryBlocksSpan.Length; - var targetBlockSpan = new Span(memoryBlocksSpan[targetBlockIdx]); + Span targetBlockSpan = new(memoryBlocksSpan[targetBlockIdx]); for (var i = 0L; i < sourceItemsCount; i++) { targetBlockSpan[targetItemIdx++] = items[i]; @@ -303,9 +303,9 @@ namespace Recyclable.Collections int blockSize = _blockSize; int targetItemIdx = (int)(oldLongCount % blockSize); int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0); - var memoryBlocksSpan = new Span(_memoryBlocks); + Span memoryBlocksSpan = new(_memoryBlocks); var memoryBlocksCount = memoryBlocksSpan.Length; - var targetBlockSpan = new Span(memoryBlocksSpan[targetBlockIdx]); + Span targetBlockSpan = new(memoryBlocksSpan[targetBlockIdx]); for (int i = 0; i < sourceItemsCount; i++) { targetBlockSpan[targetItemIdx++] = items[i]; @@ -340,9 +340,9 @@ namespace Recyclable.Collections int blockSize = _blockSize; int targetItemIdx = (int)(oldLongCount % blockSize); int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0); - var memoryBlocksSpan = new Span(_memoryBlocks); + Span memoryBlocksSpan = new(_memoryBlocks); var memoryBlocksCount = memoryBlocksSpan.Length; - var targetBlockSpan = new Span(memoryBlocksSpan[targetBlockIdx]); + Span targetBlockSpan = new(memoryBlocksSpan[targetBlockIdx]); for (int i = 0; i < sourceItemsCount; i++) { targetBlockSpan[targetItemIdx++] = items[i];