Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

[Interpreter] Array #6965

Merged
merged 13 commits into from
Feb 12, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@

using Volatile = System.Threading.Volatile;

#if BIT64
jkotas marked this conversation as resolved.
Show resolved Hide resolved
using nuint = System.UInt64;
#else
using nuint = System.UInt32;
#endif

namespace Internal.Runtime.Augments
{
[ReflectionBlocked]
Expand Down Expand Up @@ -158,6 +164,15 @@ public static unsafe Array NewMultiDimArray(RuntimeTypeHandle typeHandleForArray
return Array.NewMultiDimArray(typeHandleForArrayType.ToEETypePtr(), pLengths, lengths.Length);
}

public static ref byte GetSzArrayElementAddress(Array array, int index)
{
if ((uint)index >= (uint)array.Length)
throw new IndexOutOfRangeException();

ref byte start = ref array.GetRawSzArrayData();
return ref Unsafe.Add(ref start, (IntPtr)((nuint)index * array.ElementSize));
}

public static IntPtr GetAllocateObjectHelperForType(RuntimeTypeHandle type)
{
return RuntimeImports.RhGetRuntimeHelperForType(CreateEETypePtr(type), RuntimeImports.RuntimeHelperKind.AllocateObject);
Expand Down
Loading