Skip to content

Commit 2b0b8f8

Browse files
committed
Removed nullable separator parameters
1 parent 1b73a5d commit 2b0b8f8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ private void MakeSeparatorList(ReadOnlySpan<char> separators, ref ValueListBuild
15791579

15801580
if (Avx2.IsSupported && Length >= 16)
15811581
{
1582-
MakeSeparatorListVectorized(ref sepListBuilder, sep0);
1582+
MakeSeparatorListVectorized(ref sepListBuilder, sep0, sep0, sep0);
15831583
return;
15841584
}
15851585

@@ -1597,7 +1597,7 @@ private void MakeSeparatorList(ReadOnlySpan<char> separators, ref ValueListBuild
15971597

15981598
if (Avx2.IsSupported && Length >= 16)
15991599
{
1600-
MakeSeparatorListVectorized(ref sepListBuilder, sep0, sep1);
1600+
MakeSeparatorListVectorized(ref sepListBuilder, sep0, sep1, sep1);
16011601
return;
16021602
}
16031603

@@ -1654,10 +1654,8 @@ private void MakeSeparatorList(ReadOnlySpan<char> separators, ref ValueListBuild
16541654
}
16551655
}
16561656

1657-
private void MakeSeparatorListVectorized(ref ValueListBuilder<int> sepListBuilder, char c, char? c2 = null, char? c3 = null)
1657+
private void MakeSeparatorListVectorized(ref ValueListBuilder<int> sepListBuilder, char c, char c2, char c3)
16581658
{
1659-
// Constant that defines indices of characters within an AVX-Register
1660-
const ulong indicesConstant = 0xFEDCBA9876543210;
16611659
// Constant that allows for the truncation of 16-bit (FFFF/0000) values within a register to 4-bit (F/0)
16621660
Vector256<byte> shuffleConstant = Vector256.Create(0x02, 0x06, 0x0A, 0x0E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
16631661
0xFF, 0xFF, 0xFF, 0xFF, 0x02, 0x06, 0x0A, 0x0E, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
@@ -1684,6 +1682,9 @@ private void MakeSeparatorListVectorized(ref ValueListBuilder<int> sepListBuilde
16841682
mask = Avx2.Shuffle(mask, shuffleConstant);
16851683

16861684
Vector128<byte> res = Sse2.Or(mask.GetLower(), mask.GetUpper());
1685+
1686+
// Constant that defines indices of characters within an AVX-Register
1687+
const ulong indicesConstant = 0xFEDCBA9876543210;
16871688
ulong extractedBits = Bmi2.X64.ParallelBitExtract(indicesConstant, Sse2.X64.ConvertToUInt64(res.AsUInt64()));
16881689

16891690
while (true)
@@ -1696,8 +1697,8 @@ private void MakeSeparatorListVectorized(ref ValueListBuilder<int> sepListBuilde
16961697

16971698
for (; i < Length; i++)
16981699
{
1699-
char curr = this[i];
1700-
if (curr == c || (c2 != null && curr == c2) || (c3 != null && curr == c3))
1700+
char curr = Unsafe.Add(ref c0, (IntPtr)(uint)i);
1701+
if (curr == c || curr == c2 || curr == c3)
17011702
{
17021703
sepListBuilder.Append(i);
17031704
}

0 commit comments

Comments
 (0)