using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Ryujinx.Graphics.GAL.Multithreading.Model { unsafe struct PinnedSpan where T : unmanaged { private void* _ptr; private int _size; public PinnedSpan(ReadOnlySpan span) { _ptr = Unsafe.AsPointer(ref MemoryMarshal.GetReference(span)); _size = span.Length; } public ReadOnlySpan Get() { return new ReadOnlySpan(_ptr, _size * Unsafe.SizeOf()); } } }