refactoring

This commit is contained in:
Mikhail 2023-06-22 14:40:11 +08:00
parent c0d5d02a5d
commit 506b7e70f6
2 changed files with 4 additions and 7 deletions

View File

@ -1,7 +1,4 @@
using System; namespace DCFApixels.DragonECS.Relations.Utils
using System.Runtime.InteropServices;
namespace DCFApixels.DragonECS.Relations.Utils
{ {
internal static class ArrayUtility internal static class ArrayUtility
{ {

View File

@ -53,7 +53,7 @@ namespace DCFApixels.DragonECS.Relations.Utils
/// <returns> new node index</returns> /// <returns> new node index</returns>
public int InsertAfter(int nodeIndex, int value) public int InsertAfter(int nodeIndex, int value)
{ {
if(++_count >= _nodes.Length) if (++_count >= _nodes.Length)
Array.Resize(ref _nodes, _nodes.Length << 1); Array.Resize(ref _nodes, _nodes.Length << 1);
int newNodeIndex = _recycledNodesCount > 0 ? _recycledNodes[--_recycledNodesCount] : _count; int newNodeIndex = _recycledNodesCount > 0 ? _recycledNodes[--_recycledNodesCount] : _count;
@ -83,7 +83,7 @@ namespace DCFApixels.DragonECS.Relations.Utils
} }
public void Remove(int nodeIndex) public void Remove(int nodeIndex)
{ {
if(nodeIndex <= 0) if (nodeIndex <= 0)
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
ref var node = ref _nodes[nodeIndex]; ref var node = ref _nodes[nodeIndex];