From 9638bade2e15e250b6ac624bdd6598a91cfe671c Mon Sep 17 00:00:00 2001 From: Martin Evans Date: Sat, 28 Oct 2023 15:40:01 +0100 Subject: [PATCH] - Added tests covering `Enumerator`. (#164) - Removed constructor which made it easy to read out of the valid span range. - Only used in one place, fixed that call site. --- src/Arch/Core/Archetype.cs | 2 +- src/Arch/Core/Enumerators.cs | 16 ---------------- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/Arch/Core/Archetype.cs b/src/Arch/Core/Archetype.cs index 262ded73..716d61f7 100644 --- a/src/Arch/Core/Archetype.cs +++ b/src/Arch/Core/Archetype.cs @@ -404,7 +404,7 @@ internal void SetRange(in Slot from, in Slot to, in T? component = default) [MethodImpl(MethodImplOptions.AggressiveInlining)] public Enumerator GetEnumerator() { - return new Enumerator(Chunks.AsSpan(), Size); + return new Enumerator(Chunks.AsSpan(0, Size)); } /// diff --git a/src/Arch/Core/Enumerators.cs b/src/Arch/Core/Enumerators.cs index 1a6e6416..6c74f9df 100644 --- a/src/Arch/Core/Enumerators.cs +++ b/src/Arch/Core/Enumerators.cs @@ -39,22 +39,6 @@ public Enumerator(Span span) _index = _length; } - /// - /// Initializes a new instance of the struct. - /// - /// The with items to iterate over. - /// Its length or size. - public Enumerator(Span span, int length) - { -#if NET7_0_OR_GREATER - _ptr = ref MemoryMarshal.GetReference(span); -#else - _ptr = new Ref(ref span.DangerousGetReference()); -#endif - _length = length; - _index = _length; - } - /// /// Moves to the next item. ///