Smaller minor optimizations

This commit is contained in:
Asriel Camora
2023-07-06 19:45:59 +02:00
parent 1f5da66bc6
commit 2894867195
4 changed files with 13 additions and 21 deletions
+2 -2
View File
@@ -30,9 +30,9 @@ public sealed class ArenaNode<T> where T : struct
if (Data == null)
Interlocked.CompareExchange(ref Data, new ArenaNode<T>[BatchCount][], null);
var index = Interlocked.Increment(ref this.index) - 1;
var idx = Interlocked.Increment(ref this.index) - 1;
var (arrayIdx, subIdx) = GetArrayIndex(index);
var (arrayIdx, subIdx) = GetArrayIndex(idx);
if (Data[arrayIdx] == null)
Interlocked.CompareExchange(ref Data[arrayIdx], new ArenaNode<T>[BatchSize], null);