aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Common/Memory/SpanReader.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Common/Memory/SpanReader.cs')
-rw-r--r--Ryujinx.Common/Memory/SpanReader.cs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Ryujinx.Common/Memory/SpanReader.cs b/Ryujinx.Common/Memory/SpanReader.cs
index e46649e1..673932d0 100644
--- a/Ryujinx.Common/Memory/SpanReader.cs
+++ b/Ryujinx.Common/Memory/SpanReader.cs
@@ -33,6 +33,11 @@ namespace Ryujinx.Common.Memory
return data;
}
+ public ReadOnlySpan<byte> GetSpanSafe(int size)
+ {
+ return GetSpan((int)Math.Min((uint)_input.Length, (uint)size));
+ }
+
public T ReadAt<T>(int offset) where T : unmanaged
{
return MemoryMarshal.Cast<byte, T>(_input.Slice(offset))[0];