@@ -36,7 +36,7 @@ public static unsafe bool BitwiseEquals<T>(this ReadOnlySpan<T> x, ReadOnlySpan<
3636 var sizeInBytes = size * sizeof ( T ) ;
3737 var partX = MemoryMarshal . CreateReadOnlySpan ( ref Unsafe . As < T , byte > ( ref MemoryMarshal . GetReference ( x ) ) , sizeInBytes ) ;
3838 var partY = MemoryMarshal . CreateReadOnlySpan ( ref Unsafe . As < T , byte > ( ref MemoryMarshal . GetReference ( y ) ) , sizeInBytes ) ;
39- if ( MemoryExtensions . SequenceEqual ( partX , partY ) is false )
39+ if ( partX . SequenceEqual ( partY ) is false )
4040 return false ;
4141 }
4242
@@ -70,7 +70,7 @@ public static unsafe int BitwiseCompare<T>(this ReadOnlySpan<T> x, ReadOnlySpan<
7070 var sizeInBytes = size * sizeof ( T ) ;
7171 var partX = MemoryMarshal . CreateReadOnlySpan ( ref Unsafe . As < T , byte > ( ref MemoryMarshal . GetReference ( x ) ) , sizeInBytes ) ;
7272 var partY = MemoryMarshal . CreateReadOnlySpan ( ref Unsafe . As < T , byte > ( ref MemoryMarshal . GetReference ( y ) ) , sizeInBytes ) ;
73- result = MemoryExtensions . SequenceCompareTo ( partX , partY ) ;
73+ result = partX . SequenceCompareTo ( partY ) ;
7474 if ( result is not 0 )
7575 break ;
7676 }
@@ -87,7 +87,7 @@ public static unsafe int BitwiseCompare<T>(this ReadOnlySpan<T> x, ReadOnlySpan<
8787 /// <typeparam name="T">The type of the elements.</typeparam>
8888 [ CLSCompliant ( false ) ]
8989 public static unsafe void Sort < T > ( this Span < T > span , delegate * < T ? , T ? , int > comparison )
90- => MemoryExtensions . Sort < T , ComparerWrapper < T > > ( span , comparison ) ;
90+ => span . Sort < T , ComparerWrapper < T > > ( comparison ) ;
9191
9292 /// <summary>
9393 /// Trims the span to specified length if it exceeds it.
@@ -305,9 +305,7 @@ public static MemoryOwner<T> Concat<T>(this ReadOnlySpan<T> first, ReadOnlySpan<
305305 case < 0 :
306306 throw new OutOfMemoryException ( ) ;
307307 default :
308- result = allocator is null
309- ? new ( ArrayPool < T > . Shared , length )
310- : allocator ( length ) ;
308+ result = allocator ? . Invoke ( length ) ?? new ( ArrayPool < T > . Shared , length ) ;
311309
312310 var output = result . Span ;
313311 first . CopyTo ( output ) ;
@@ -350,9 +348,7 @@ public static MemoryOwner<T> Concat<T>(this ReadOnlySpan<T> first, ReadOnlySpan<
350348 return default ;
351349
352350 var length = checked ( first . Length + second . Length + third . Length ) ;
353- var result = allocator is null ?
354- new MemoryOwner < T > ( ArrayPool < T > . Shared , length ) :
355- allocator ( length ) ;
351+ var result = allocator ? . Invoke ( length ) ?? new MemoryOwner < T > ( ArrayPool < T > . Shared , length ) ;
356352
357353 var output = result . Span ;
358354 first . CopyTo ( output ) ;
@@ -374,10 +370,7 @@ public static MemoryOwner<T> Copy<T>(this ReadOnlySpan<T> span, MemoryAllocator<
374370 if ( span . IsEmpty )
375371 return default ;
376372
377- var result = allocator is null ?
378- new MemoryOwner < T > ( ArrayPool < T > . Shared , span . Length ) :
379- allocator ( span . Length ) ;
380-
373+ var result = allocator ? . Invoke ( span . Length ) ?? new MemoryOwner < T > ( ArrayPool < T > . Shared , span . Length ) ;
381374 span . CopyTo ( result . Span ) ;
382375 return result ;
383376 }
@@ -500,10 +493,7 @@ public static MemoryOwner<char> Concat(ReadOnlySpan<string?> values, MemoryAlloc
500493 if ( totalLength > Array . MaxLength )
501494 throw new OutOfMemoryException ( ) ;
502495
503- result = allocator is null
504- ? new ( ArrayPool < char > . Shared , ( int ) totalLength )
505- : allocator ( ( int ) totalLength ) ;
506-
496+ result = allocator ? . Invoke ( ( int ) totalLength ) ?? new ( ArrayPool < char > . Shared , ( int ) totalLength ) ;
507497 var output = result . Span ;
508498 foreach ( ReadOnlySpan < char > str in values )
509499 {
0 commit comments