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

@@ -65,6 +65,21 @@ namespace System
return true;
}
// adapted to the Mono array layout
[StructLayout(LayoutKind.Sequential)]
private class RawData
{
public IntPtr Bounds;
public IntPtr Count;
public byte Data;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal ref byte GetRawSzArrayData()
{
return ref Unsafe.As<RawData>(this).Data;
}
internal IEnumerator<T> InternalArray__IEnumerable_GetEnumerator<T> ()
{
if (Length == 0)
@@ -571,26 +586,27 @@ namespace System
throw new ArgumentException ("length");
if (dest_pos > destinationArray.Length - length) {
string msg = "Destination array was not long enough. Check " +
"destIndex and length, and the array's lower bounds";
throw new ArgumentException (msg, string.Empty);
throw new ArgumentException ("Destination array was not long enough. Check destIndex and length, and the array's lower bounds", nameof (destinationArray));
}
Type src_type = sourceArray.GetType ().GetElementType ();
Type dst_type = destinationArray.GetType ().GetElementType ();
var dst_type_vt = dst_type.IsValueType;
if (!Object.ReferenceEquals (sourceArray, destinationArray) || source_pos > dest_pos) {
for (int i = 0; i < length; i++) {
Object srcval = sourceArray.GetValueImpl (source_pos + i);
if (srcval == null && dst_type_vt)
throw new InvalidCastException ();
try {
destinationArray.SetValueImpl (srcval, dest_pos + i);
} catch (ArgumentException) {
throw CreateArrayTypeMismatchException ();
} catch {
} catch (InvalidCastException) {
if (CanAssignArrayElement (src_type, dst_type))
throw;
throw CreateArrayTypeMismatchException ();
}
}
@@ -613,7 +629,7 @@ namespace System
}
}
static Exception CreateArrayTypeMismatchException ()
static ArrayTypeMismatchException CreateArrayTypeMismatchException ()
{
return new ArrayTypeMismatchException ();
}

View File

@@ -62,6 +62,8 @@ namespace System
private IntPtr delegate_trampoline;
private IntPtr extra_arg;
private IntPtr method_code;
private IntPtr interp_method;
private IntPtr interp_invoke_impl;
private MethodInfo method_info;
// Keep a ref of the MethodInfo passed to CreateDelegate.

View File

@@ -0,0 +1,88 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
/*============================================================
**
** Purpose: Some single-precision floating-point math operations
**
===========================================================*/
//This class contains only static members and doesn't require serialization.
using System.Runtime.CompilerServices;
namespace System
{
public static partial class MathF
{
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Acos(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Acosh(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Asin(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Asinh(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Atan(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Atan2(float y, float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Atanh(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Cbrt(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Ceiling(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Cos(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Cosh(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Exp(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Floor(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Log(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Log10(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Pow(float x, float y);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Sin(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Sinh(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Sqrt(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Tan(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern float Tanh(float x);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern float FMod(float x, float y);
[MethodImpl(MethodImplOptions.InternalCall)]
private static extern unsafe float ModF(float x, float* intptr);
}
}