Imported Upstream version 5.16.0.100

Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-08-07 15:19:03 +00:00
parent 0a9828183b
commit 7d7f676260
4419 changed files with 170950 additions and 90273 deletions

View File

@ -1,4 +1,5 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Globalization
{
@ -198,7 +199,7 @@ namespace System.Globalization
return c;
}
static unsafe int InternalCompareStringOrdinalIgnoreCase (String strA, int indexA, String strB, int indexB, int lenA, int lenB)
internal static unsafe int InternalCompareStringOrdinalIgnoreCase (String strA, int indexA, String strB, int indexB, int lenA, int lenB)
{
if (strA == null) {
return strB == null ? 0 : -1;
@ -229,6 +230,47 @@ namespace System.Globalization
return lengthA - lengthB;
}
}
internal void ToLowerAsciiInvariant (ReadOnlySpan<char> source, Span<char> destination)
{
for (int i = 0; i < source.Length; i++)
{
destination [i] = ToLowerAsciiInvariant (source [i]);
}
}
internal void ToUpperAsciiInvariant (ReadOnlySpan<char> source, Span<char> destination)
{
for (int i = 0; i < source.Length; i++)
{
destination [i] = ToUpperAsciiInvariant (source[i]);
}
}
internal unsafe void ChangeCase (ReadOnlySpan<char> source, Span<char> destination, bool toUpper)
{
if (source.IsEmpty)
return;
var ti = CultureInfo.CurrentCulture.TextInfo;
fixed (char* pSource = &MemoryMarshal.GetReference (source))
fixed (char* pResult = &MemoryMarshal.GetReference (destination)) {
int length = 0;
char* a = pSource, b = pResult;
if (toUpper) {
while (length < source.Length) {
*b++ = ti.ToUpper (*a++);
length++;
}
} else {
while (length < source.Length) {
*b++ = ti.ToLower (*a++);
length++;
}
}
}
}
}
static class TextInfoToUpperData