@@ -1549,32 +1549,26 @@ private bool SkipWhitespaces()
15491549 Vector . Equals ( currentVector , newlineCharVector ) |
15501550 Vector . Equals ( currentVector , carriageCharVector ) ;
15511551
1552- // Check if ALL characters in this vector are whitespace
1553- if ( Vector . EqualsAll ( isWhitespace , ushortMaxValueVector ) )
1554- {
1555- // All characters in this vector are whitespace, continue to next vector
1556- processedVectors ++ ;
1557- }
1558- else
1552+ // If not all characters are whitespace, find the first non-whitespace character
1553+ if ( ! Vector . EqualsAll ( isWhitespace , ushortMaxValueVector ) )
15591554 {
15601555 // Found at least one non-whitespace character in this vector
1561- // Find the exact position within this vector
15621556 for ( int i = 0 ; i < vectorSize ; i ++ )
15631557 {
15641558 // 0 means NOT whitespace
1565- if ( isWhitespace [ i ] == 0 )
1559+ if ( isWhitespace [ i ] == ushort . MinValue )
15661560 {
15671561 this . tokenStartIndex += ( processedVectors * vectorSize ) + i ;
15681562
15691563 // Found non-whitespace character
1570- return true ;
1564+ return true ;
15711565 }
15721566 }
1573-
1574- // This should never happen due to the EqualsAll check above
1575- // But if it does, advance and return
1576- this . tokenStartIndex += ( processedVectors + 1 ) * vectorSize ;
1577- return true ;
1567+ }
1568+ else
1569+ {
1570+ // All characters in this vector are whitespace, continue to next vector
1571+ processedVectors ++ ;
15781572 }
15791573 }
15801574
@@ -2625,7 +2619,7 @@ private static int SkipWhitespacesVectorized(ReadOnlySpan<char> span, int vector
26252619 // Found a non-whitespace character in the vector
26262620 for ( int i = 0 ; i < vectorSize ; i ++ )
26272621 {
2628- if ( isWhitespace [ i ] == 0 )
2622+ if ( isWhitespace [ i ] == ushort . MinValue )
26292623 {
26302624 return processed + i ;
26312625 }
0 commit comments