[rebuid]use dynamic wrapping instead of static wrapping

This commit is contained in:
Youmu Liu
2025-11-03 20:03:50 +08:00
parent ee97dfddfb
commit 9c4c71dc5b
15 changed files with 331 additions and 595 deletions
@@ -28,7 +28,6 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace StgSharp.Collections
@@ -88,6 +87,13 @@ namespace StgSharp.Collections
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public ReadOnlySpan<T> PopRange(int count)
{
int i = int.Min(count, _index) - 1;
return _values[0..i];
}
public void Push(T item)
{
_values[++_index] = _index < _values.Length - 1 ?