Tiny code readability improvement
This commit is contained in:
1 parent
85fcf69c75
commit
c923383a71
1 file changed
+8
-8
@@ -92,10 +92,10 @@ namespace Recyclable.Collections
|
|||||||
? new T[localInts[requiredBlockCount]][]
|
? new T[localInts[requiredBlockCount]][]
|
||||||
: memoryBlocksPool.Rent(localInts[requiredBlockCount]);
|
: memoryBlocksPool.Rent(localInts[requiredBlockCount]);
|
||||||
|
|
||||||
var newMemoryBlocksSpan = new Span<T[]>(newMemoryBlocks);
|
Span<T[]> newMemoryBlocksSpan = new(newMemoryBlocks);
|
||||||
if (localInts[sourceBlockCount] > 0)
|
if (localInts[sourceBlockCount] > 0)
|
||||||
{
|
{
|
||||||
var sourceSpan = new Span<T[]>(source);
|
Span<T[]> sourceSpan = new(source);
|
||||||
sourceSpan.CopyTo(newMemoryBlocksSpan);
|
sourceSpan.CopyTo(newMemoryBlocksSpan);
|
||||||
if (localInts[sourceBlockCount] >= RecyclableDefaults.MinPooledArrayLength)
|
if (localInts[sourceBlockCount] >= RecyclableDefaults.MinPooledArrayLength)
|
||||||
{
|
{
|
||||||
@@ -266,9 +266,9 @@ namespace Recyclable.Collections
|
|||||||
int blockSize = _blockSize;
|
int blockSize = _blockSize;
|
||||||
int targetItemIdx = (int)(oldLongCount % blockSize);
|
int targetItemIdx = (int)(oldLongCount % blockSize);
|
||||||
int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0);
|
int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0);
|
||||||
var memoryBlocksSpan = new Span<T[]>(_memoryBlocks);
|
Span<T[]> memoryBlocksSpan = new(_memoryBlocks);
|
||||||
int memoryBlocksCount = memoryBlocksSpan.Length;
|
int memoryBlocksCount = memoryBlocksSpan.Length;
|
||||||
var targetBlockSpan = new Span<T>(memoryBlocksSpan[targetBlockIdx]);
|
Span<T> targetBlockSpan = new(memoryBlocksSpan[targetBlockIdx]);
|
||||||
for (var i = 0L; i < sourceItemsCount; i++)
|
for (var i = 0L; i < sourceItemsCount; i++)
|
||||||
{
|
{
|
||||||
targetBlockSpan[targetItemIdx++] = items[i];
|
targetBlockSpan[targetItemIdx++] = items[i];
|
||||||
@@ -303,9 +303,9 @@ namespace Recyclable.Collections
|
|||||||
int blockSize = _blockSize;
|
int blockSize = _blockSize;
|
||||||
int targetItemIdx = (int)(oldLongCount % blockSize);
|
int targetItemIdx = (int)(oldLongCount % blockSize);
|
||||||
int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0);
|
int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0);
|
||||||
var memoryBlocksSpan = new Span<T[]>(_memoryBlocks);
|
Span<T[]> memoryBlocksSpan = new(_memoryBlocks);
|
||||||
var memoryBlocksCount = memoryBlocksSpan.Length;
|
var memoryBlocksCount = memoryBlocksSpan.Length;
|
||||||
var targetBlockSpan = new Span<T>(memoryBlocksSpan[targetBlockIdx]);
|
Span<T> targetBlockSpan = new(memoryBlocksSpan[targetBlockIdx]);
|
||||||
for (int i = 0; i < sourceItemsCount; i++)
|
for (int i = 0; i < sourceItemsCount; i++)
|
||||||
{
|
{
|
||||||
targetBlockSpan[targetItemIdx++] = items[i];
|
targetBlockSpan[targetItemIdx++] = items[i];
|
||||||
@@ -340,9 +340,9 @@ namespace Recyclable.Collections
|
|||||||
int blockSize = _blockSize;
|
int blockSize = _blockSize;
|
||||||
int targetItemIdx = (int)(oldLongCount % blockSize);
|
int targetItemIdx = (int)(oldLongCount % blockSize);
|
||||||
int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0);
|
int targetBlockIdx = (int)(oldLongCount / blockSize) + (targetItemIdx > 0 ? 1 : 0);
|
||||||
var memoryBlocksSpan = new Span<T[]>(_memoryBlocks);
|
Span<T[]> memoryBlocksSpan = new(_memoryBlocks);
|
||||||
var memoryBlocksCount = memoryBlocksSpan.Length;
|
var memoryBlocksCount = memoryBlocksSpan.Length;
|
||||||
var targetBlockSpan = new Span<T>(memoryBlocksSpan[targetBlockIdx]);
|
Span<T> targetBlockSpan = new(memoryBlocksSpan[targetBlockIdx]);
|
||||||
for (int i = 0; i < sourceItemsCount; i++)
|
for (int i = 0; i < sourceItemsCount; i++)
|
||||||
{
|
{
|
||||||
targetBlockSpan[targetItemIdx++] = items[i];
|
targetBlockSpan[targetItemIdx++] = items[i];
|
||||||
|
|||||||
Reference in new issue
Block a user