diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs b/src/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs new file mode 100644 index 00000000..909a9483 --- /dev/null +++ b/src/Ryujinx.Graphics.Nvdec.Vp9/Common/MemoryUtil.cs @@ -0,0 +1,23 @@ +using System; +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); + } + } +} |
