Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ namespace System.Globalization
{
public partial class CompareInfo
{
// Characters which require special handling are those in [0x00, 0x1F] and [0x7F, 0xFFFF] except \t\v\f
// Matches HighCharTable below.
private static readonly IndexOfAnyValues<char> s_nonSpecialAsciiChars =
IndexOfAnyValues.Create("\t\v\f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");

[NonSerialized]
private bool _isAsciiEqualityOrdinal;

Expand Down Expand Up @@ -99,21 +104,18 @@ private unsafe int IndexOfOrdinalIgnoreCaseHelper(ReadOnlySpan<char> source, Rea
char* a = ap;
char* b = bp;

for (int j = 0; j < target.Length; j++)
if (target.IndexOfAnyExcept(s_nonSpecialAsciiChars) >= 0)
{
char targetChar = *(b + j);
if (targetChar >= 0x80 || HighCharTable[targetChar])
goto InteropCall;
goto InteropCall;
}

if (target.Length > source.Length)
{
for (int k = 0; k < source.Length; k++)
if (source.IndexOfAnyExcept(s_nonSpecialAsciiChars) >= 0)
{
char targetChar = *(a + k);
if (targetChar >= 0x80 || HighCharTable[targetChar])
goto InteropCall;
goto InteropCall;
}

return -1;
}

Expand Down Expand Up @@ -203,21 +205,18 @@ private unsafe int IndexOfOrdinalHelper(ReadOnlySpan<char> source, ReadOnlySpan<
char* a = ap;
char* b = bp;

for (int j = 0; j < target.Length; j++)
if (target.IndexOfAnyExcept(s_nonSpecialAsciiChars) >= 0)
{
char targetChar = *(b + j);
if (targetChar >= 0x80 || HighCharTable[targetChar])
goto InteropCall;
goto InteropCall;
}

if (target.Length > source.Length)
{
for (int k = 0; k < source.Length; k++)
if (source.IndexOfAnyExcept(s_nonSpecialAsciiChars) >= 0)
{
char targetChar = *(a + k);
if (targetChar >= 0x80 || HighCharTable[targetChar])
goto InteropCall;
goto InteropCall;
}

return -1;
}

Expand Down