MemoryUtil.cs
1 using System; 2 using System.Runtime.InteropServices; 3 4 namespace Ryujinx.Graphics.Nvdec.Vp9.Common 5 { 6 internal static class MemoryUtil 7 { 8 public static unsafe void Copy<T>(T* dest, T* source, int length) where T : unmanaged 9 { 10 new Span<T>(source, length).CopyTo(new Span<T>(dest, length)); 11 } 12 13 public static void Copy<T>(ref T dest, ref T source) where T : unmanaged 14 { 15 MemoryMarshal.CreateSpan(ref source, 1).CopyTo(MemoryMarshal.CreateSpan(ref dest, 1)); 16 } 17 18 public static unsafe void Fill<T>(T* ptr, T value, int length) where T : unmanaged 19 { 20 new Span<T>(ptr, length).Fill(value); 21 } 22 } 23 }