* allow ASCII equality ordinal fast path for en-* cultures
* dont use StartsWith in the initialization execution path
* Update src/System.Private.CoreLib/shared/System/Globalization/CompareInfo.Unix.cs
Co-Authored-By: Jan Kotas <jkotas@microsoft.com>
Commit migrated from https://github.com/dotnet/coreclr/commit/
87e4971a68114987d81a21ba6df9035e30255c51
}
else
{
- _isAsciiEqualityOrdinal = (_sortName == "en-US" || _sortName == "");
+ // Inline the following condition to avoid potential implementation cycles within globalization
+ //
+ // _isAsciiEqualityOrdinal = _sortName == "" || _sortName == "en" || _sortName.StartsWith("en-", StringComparison.Ordinal);
+ //
+ _isAsciiEqualityOrdinal = _sortName.Length == 0 ||
+ (_sortName.Length >= 2 && _sortName[0] == 'e' && _sortName[1] == 'n' && (_sortName.Length == 2 || _sortName[2] == '-'));
_sortHandle = SortHandleCache.GetCachedSortHandle(_sortName);
}