From 66364ce4f9ad52001b02de1126ffb15dd0709675 Mon Sep 17 00:00:00 2001 From: mlemanczyk Date: Sat, 5 Aug 2023 00:37:25 +0200 Subject: [PATCH] Assignments converted to spans --- Recyclable.Collections/RecyclableLongList.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Recyclable.Collections/RecyclableLongList.cs b/Recyclable.Collections/RecyclableLongList.cs index e6b7c8b..6d9fd9c 100644 --- a/Recyclable.Collections/RecyclableLongList.cs +++ b/Recyclable.Collections/RecyclableLongList.cs @@ -902,8 +902,9 @@ namespace Recyclable.Collections if (NeedsClearing) { - // TODO: Can we benefit from Span here? - _memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default; +#nullable disable + new Span(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = default; +#nullable restore } _version++; @@ -971,8 +972,9 @@ namespace Recyclable.Collections if (NeedsClearing) { - // TODO: Can we benefit from Span here? - _memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default; +#nullable disable + new Span(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = default; +#nullable restore } _version++; @@ -1010,8 +1012,9 @@ namespace Recyclable.Collections if (NeedsClearing) { - // TODO: Can we benefit from Span here? - _memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default; +#nullable disable + new Span(_memoryBlocks[_nextItemBlockIndex])[_nextItemIndex] = default; +#nullable restore } _version++;