aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs')
-rw-r--r--src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs b/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs
index 103fb6a0..4771ae4d 100644
--- a/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs
+++ b/src/Ryujinx.Audio/Renderer/Utils/SpanIOHelper.cs
@@ -22,12 +22,12 @@ namespace Ryujinx.Audio.Renderer.Utils
if (size > backingMemory.Length)
{
- throw new ArgumentOutOfRangeException();
+ throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null);
}
- MemoryMarshal.Write<T>(backingMemory.Span.Slice(0, size), ref data);
+ MemoryMarshal.Write(backingMemory.Span[..size], ref data);
- backingMemory = backingMemory.Slice(size);
+ backingMemory = backingMemory[size..];
}
/// <summary>
@@ -42,12 +42,12 @@ namespace Ryujinx.Audio.Renderer.Utils
if (size > backingMemory.Length)
{
- throw new ArgumentOutOfRangeException();
+ throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null);
}
- MemoryMarshal.Write<T>(backingMemory.Slice(0, size), ref data);
+ MemoryMarshal.Write(backingMemory[..size], ref data);
- backingMemory = backingMemory.Slice(size);
+ backingMemory = backingMemory[size..];
}
/// <summary>
@@ -62,12 +62,12 @@ namespace Ryujinx.Audio.Renderer.Utils
if (size > backingMemory.Length)
{
- throw new ArgumentOutOfRangeException();
+ throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null);
}
- Span<T> result = MemoryMarshal.Cast<byte, T>(backingMemory.Span.Slice(0, size));
+ Span<T> result = MemoryMarshal.Cast<byte, T>(backingMemory.Span[..size]);
- backingMemory = backingMemory.Slice(size);
+ backingMemory = backingMemory[size..];
return result;
}
@@ -84,12 +84,12 @@ namespace Ryujinx.Audio.Renderer.Utils
if (size > backingMemory.Length)
{
- throw new ArgumentOutOfRangeException();
+ throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null);
}
- Span<T> result = MemoryMarshal.Cast<byte, T>(backingMemory.Slice(0, size));
+ Span<T> result = MemoryMarshal.Cast<byte, T>(backingMemory[..size]);
- backingMemory = backingMemory.Slice(size);
+ backingMemory = backingMemory[size..];
return result;
}
@@ -106,12 +106,12 @@ namespace Ryujinx.Audio.Renderer.Utils
if (size > backingMemory.Length)
{
- throw new ArgumentOutOfRangeException();
+ throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null);
}
- T result = MemoryMarshal.Read<T>(backingMemory.Span.Slice(0, size));
+ T result = MemoryMarshal.Read<T>(backingMemory.Span[..size]);
- backingMemory = backingMemory.Slice(size);
+ backingMemory = backingMemory[size..];
return result;
}
@@ -128,12 +128,12 @@ namespace Ryujinx.Audio.Renderer.Utils
if (size > backingMemory.Length)
{
- throw new ArgumentOutOfRangeException();
+ throw new ArgumentOutOfRangeException(nameof(backingMemory), backingMemory.Length, null);
}
- T result = MemoryMarshal.Read<T>(backingMemory.Slice(0, size));
+ T result = MemoryMarshal.Read<T>(backingMemory[..size]);
- backingMemory = backingMemory.Slice(size);
+ backingMemory = backingMemory[size..];
return result;
}
@@ -168,4 +168,4 @@ namespace Ryujinx.Audio.Renderer.Utils
return ref GetMemory(memory, id, count).Span[0];
}
}
-} \ No newline at end of file
+}