@@ -306,15 +306,15 @@ static virtual TSelf Parse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IFor
306306 scoped Span < char > utf16Text ;
307307 int textMaxCharCount = Encoding . UTF8 . GetMaxCharCount ( utf8Text . Length ) ;
308308
309- if ( textMaxCharCount < 256 )
309+ if ( textMaxCharCount <= 256 )
310310 {
311311 utf16TextArray = null ;
312312 utf16Text = stackalloc char [ 256 ] ;
313313 }
314314 else
315315 {
316316 utf16TextArray = ArrayPool < char > . Shared . Rent ( textMaxCharCount ) ;
317- utf16Text = utf16TextArray . AsSpan ( 0 , textMaxCharCount ) ;
317+ utf16Text = utf16TextArray ;
318318 }
319319
320320 OperationStatus utf8TextStatus = Utf8 . ToUtf16 ( utf8Text , utf16Text , out _ , out int utf16TextLength , replaceInvalidSequences : false ) ;
@@ -440,15 +440,15 @@ static virtual bool TryParse(ReadOnlySpan<byte> utf8Text, NumberStyles style, IF
440440 scoped Span < char > utf16Text ;
441441 int textMaxCharCount = Encoding . UTF8 . GetMaxCharCount ( utf8Text . Length ) ;
442442
443- if ( textMaxCharCount < 256 )
443+ if ( textMaxCharCount <= 256 )
444444 {
445445 utf16TextArray = null ;
446446 utf16Text = stackalloc char [ 256 ] ;
447447 }
448448 else
449449 {
450450 utf16TextArray = ArrayPool < char > . Shared . Rent ( textMaxCharCount ) ;
451- utf16Text = utf16TextArray . AsSpan ( 0 , textMaxCharCount ) ;
451+ utf16Text = utf16TextArray ;
452452 }
453453
454454 OperationStatus utf8TextStatus = Utf8 . ToUtf16 ( utf8Text , utf16Text , out _ , out int utf16TextLength , replaceInvalidSequences : false ) ;
@@ -486,15 +486,15 @@ bool IUtf8SpanFormattable.TryFormat(Span<byte> utf8Destination, out int bytesWri
486486 scoped Span < char > utf16Destination ;
487487 int destinationMaxCharCount = Encoding . UTF8 . GetMaxCharCount ( utf8Destination . Length ) ;
488488
489- if ( destinationMaxCharCount < 256 )
489+ if ( destinationMaxCharCount <= 256 )
490490 {
491491 utf16DestinationArray = null ;
492492 utf16Destination = stackalloc char [ 256 ] ;
493493 }
494494 else
495495 {
496496 utf16DestinationArray = ArrayPool < char > . Shared . Rent ( destinationMaxCharCount ) ;
497- utf16Destination = utf16DestinationArray . AsSpan ( 0 , destinationMaxCharCount ) ;
497+ utf16Destination = utf16DestinationArray ;
498498 }
499499
500500 if ( ! TryFormat ( utf16Destination , out int charsWritten , format , provider ) )
@@ -542,15 +542,15 @@ static TSelf IUtf8SpanParsable<TSelf>.Parse(ReadOnlySpan<byte> utf8Text, IFormat
542542 scoped Span < char > utf16Text ;
543543 int textMaxCharCount = Encoding . UTF8 . GetMaxCharCount ( utf8Text . Length ) ;
544544
545- if ( textMaxCharCount < 256 )
545+ if ( textMaxCharCount <= 256 )
546546 {
547547 utf16TextArray = null ;
548548 utf16Text = stackalloc char [ 256 ] ;
549549 }
550550 else
551551 {
552552 utf16TextArray = ArrayPool < char > . Shared . Rent ( textMaxCharCount ) ;
553- utf16Text = utf16TextArray . AsSpan ( 0 , textMaxCharCount ) ;
553+ utf16Text = utf16TextArray ;
554554 }
555555
556556 OperationStatus utf8TextStatus = Utf8 . ToUtf16 ( utf8Text , utf16Text , out _ , out int utf16TextLength , replaceInvalidSequences : false ) ;
@@ -589,15 +589,15 @@ static bool IUtf8SpanParsable<TSelf>.TryParse(ReadOnlySpan<byte> utf8Text, IForm
589589 scoped Span < char > utf16Text ;
590590 int textMaxCharCount = Encoding . UTF8 . GetMaxCharCount ( utf8Text . Length ) ;
591591
592- if ( textMaxCharCount < 256 )
592+ if ( textMaxCharCount <= 256 )
593593 {
594594 utf16TextArray = null ;
595595 utf16Text = stackalloc char [ 256 ] ;
596596 }
597597 else
598598 {
599599 utf16TextArray = ArrayPool < char > . Shared . Rent ( textMaxCharCount ) ;
600- utf16Text = utf16TextArray . AsSpan ( 0 , textMaxCharCount ) ;
600+ utf16Text = utf16TextArray ;
601601 }
602602
603603 OperationStatus utf8TextStatus = Utf8 . ToUtf16 ( utf8Text , utf16Text , out _ , out int utf16TextLength , replaceInvalidSequences : false ) ;
0 commit comments