Files
Shopping_UnityVR/Packages/com.baddog.rendering.arealight/Runtime/Passes/NativeArrayExtensionsCompat.cs
2026-04-16 04:58:10 +09:00

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);
}
}
}