@@ -6,30 +6,28 @@ namespace LinkDotNet.StringBuilder;
66/// <summary>
77/// Represents a List based on the <see cref="Span{T}"/> type.
88/// </summary>
9- /// <typeparam name="T">Any struct.</typeparam>
109[ StructLayout ( LayoutKind . Auto ) ]
1110[ SkipLocalsInit ]
12- internal ref struct TypedSpanList < T >
13- where T : struct
11+ internal ref struct IntegerSpanList
1412{
15- private Span < T > buffer ;
13+ private Span < int > buffer ;
1614 private int count ;
1715
1816 /// <summary>
19- /// Initializes a new instance of the <see cref="TypedSpanList{T} "/> struct.
17+ /// Initializes a new instance of the <see cref="IntegerSpanList "/> struct.
2018 /// </summary>
2119 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
22- public TypedSpanList ( )
20+ public IntegerSpanList ( )
2321 {
24- buffer = GC . AllocateUninitializedArray < T > ( 8 ) ;
22+ buffer = GC . AllocateUninitializedArray < int > ( 8 ) ;
2523 count = 0 ;
2624 }
2725
2826 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
29- public readonly ReadOnlySpan < T > AsSpan ( ) => buffer [ ..count ] ;
27+ public readonly ReadOnlySpan < int > AsSpan ( ) => buffer [ ..count ] ;
3028
3129 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
32- public void Add ( T value )
30+ public void Add ( int value )
3331 {
3432 if ( count >= buffer . Length )
3533 {
@@ -45,7 +43,7 @@ private void Grow(int capacity = 0)
4543 {
4644 var currentSize = buffer . Length ;
4745 var newSize = capacity > 0 ? capacity : currentSize * 2 ;
48- var rented = GC . AllocateUninitializedArray < T > ( newSize ) ;
46+ var rented = GC . AllocateUninitializedArray < int > ( newSize ) ;
4947 buffer [ ..count ] . CopyTo ( rented ) ;
5048 buffer = rented ;
5149 }
0 commit comments