aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs')
-rw-r--r--Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs b/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs
new file mode 100644
index 00000000..e53ec9bd
--- /dev/null
+++ b/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs
@@ -0,0 +1,25 @@
+using Ryujinx.Common.Memory;
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace Ryujinx.Graphics.Nvdec.Vp9.Common
+{
+ internal static class MemoryUtil
+ {
+ public static unsafe void Copy<T>(T* dest, T* source, int length) where T : unmanaged
+ {
+ new Span<T>(source, length).CopyTo(new Span<T>(dest, length));
+ }
+
+ public static void Copy<T>(ref T dest, ref T source) where T : unmanaged
+ {
+ MemoryMarshal.CreateSpan(ref source, 1).CopyTo(MemoryMarshal.CreateSpan(ref dest, 1));
+ }
+
+ public static unsafe void Fill<T>(T* ptr, T value, int length) where T : unmanaged
+ {
+ new Span<T>(ptr, length).Fill(value);
+ }
+ }
+}