You've already forked linux-packaging-mono
Imported Upstream version 5.16.0.100
Former-commit-id: 38faa55fb9669e35e7d8448b15c25dc447f25767
This commit is contained in:
parent
0a9828183b
commit
7d7f676260
@@ -1,3 +1,12 @@
|
||||
#if BIT64
|
||||
using nuint = System.UInt64;
|
||||
#else
|
||||
using nuint = System.UInt32;
|
||||
#endif
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime;
|
||||
|
||||
namespace System
|
||||
{
|
||||
partial class Buffer
|
||||
@@ -213,7 +222,28 @@ namespace System
|
||||
|
||||
internal static unsafe void Memmove (byte *dest, byte *src, uint len)
|
||||
{
|
||||
if (((nuint)dest - (nuint)src < len) || ((nuint)src - (nuint)dest < len))
|
||||
goto PInvoke;
|
||||
Memcpy (dest, src, (int) len);
|
||||
return;
|
||||
|
||||
PInvoke:
|
||||
RuntimeImports.Memmove(dest, src, len);
|
||||
}
|
||||
|
||||
internal static void Memmove<T>(ref T destination, ref T source, nuint elementCount)
|
||||
{
|
||||
if (!RuntimeHelpers.IsReferenceOrContainsReferences<T>()) {
|
||||
unsafe {
|
||||
fixed (byte* pDestination = &Unsafe.As<T, byte>(ref destination), pSource = &Unsafe.As<T, byte>(ref source))
|
||||
Memmove(pDestination, pSource, (uint)elementCount * (uint)Unsafe.SizeOf<T>());
|
||||
}
|
||||
} else {
|
||||
unsafe {
|
||||
fixed (byte* pDestination = &Unsafe.As<T, byte>(ref destination), pSource = &Unsafe.As<T, byte>(ref source))
|
||||
RuntimeImports.Memmove_wbarrier(pDestination, pSource, (uint)elementCount, typeof(T).TypeHandle.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -34,11 +34,19 @@
|
||||
//
|
||||
//
|
||||
|
||||
#if BIT64
|
||||
using nuint = System.UInt64;
|
||||
#else
|
||||
using nuint = System.UInt32;
|
||||
#endif
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics.Private;
|
||||
|
||||
namespace System
|
||||
{
|
||||
@@ -51,15 +59,6 @@ namespace System
|
||||
|
||||
public static readonly String Empty;
|
||||
|
||||
public unsafe static implicit operator ReadOnlySpan<char> (String value)
|
||||
{
|
||||
if (value == null)
|
||||
return default;
|
||||
|
||||
fixed (void* start = &value._firstChar)
|
||||
return new ReadOnlySpan<char> (start, value.Length);
|
||||
}
|
||||
|
||||
internal unsafe int IndexOfUnchecked (string value, int startIndex, int count)
|
||||
{
|
||||
int valueLen = value.Length;
|
||||
@@ -202,7 +201,12 @@ namespace System
|
||||
if (this.Length < value.Length || _firstChar != value._firstChar)
|
||||
return false;
|
||||
|
||||
return value.Length == 1 ? true : StartsWithOrdinalHelper (this, value);
|
||||
return value.Length == 1 ?
|
||||
true :
|
||||
SpanHelpers.SequenceEqual (
|
||||
ref Unsafe.As<char, byte> (ref this.GetRawStringData ()),
|
||||
ref Unsafe.As<char, byte> (ref value.GetRawStringData ()),
|
||||
((nuint)value.Length) * 2);
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user