25 lines
863 B
C#
25 lines
863 B
C#
using System.Runtime.CompilerServices;
|
|
using Unity.Collections;
|
|
using Unity.Collections.LowLevel.Unsafe;
|
|
|
|
namespace BadDog.Rendering.AreaLight
|
|
{
|
|
internal static class NativeArrayExtensionsCompat
|
|
{
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static unsafe ref readonly T UnsafeElementAt<T>(this NativeArray<T> array, int index)
|
|
where T : struct
|
|
{
|
|
return ref UnsafeUtility.ArrayElementAsRef<T>(NativeArrayUnsafeUtility.GetUnsafeReadOnlyPtr(array), index);
|
|
}
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
public static unsafe ref T UnsafeElementAtMutable<T>(this NativeArray<T> array, int index)
|
|
where T : struct
|
|
{
|
|
return ref UnsafeUtility.ArrayElementAsRef<T>(NativeArrayUnsafeUtility.GetUnsafePtr(array), index);
|
|
}
|
|
}
|
|
}
|
|
|