From fc20d9b925b83532a19467293a7cdcbaa4ef3d6b Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Wed, 28 Jun 2023 18:41:38 +0200 Subject: [Ryujinx.Common] Address dotnet-format issues (#5358) * dotnet format style --severity info Some changes were manually reverted. * dotnet format analyzers --serverity info Some changes have been minimally adapted. * Restore a few unused methods and variables * Silence dotnet format IDE0060 warnings * Silence dotnet format IDE0059 warnings * Address or silence dotnet format IDE1006 warnings * Address dotnet format CA1816 warnings * Address or silence dotnet format CA2211 warnings * Silence CA1806 and CA1834 issues * Fix formatting for switch expressions * Address most dotnet format whitespace warnings * Apply dotnet format whitespace formatting A few of them have been manually reverted and the corresponding warning was silenced * Revert formatting changes for while and for-loops * Format if-blocks correctly * Run dotnet format whitespace after rebase * Run dotnet format style after rebase * Run dotnet format analyzers after rebase * Run dotnet format after rebase and remove unused usings - analyzers - style - whitespace * Add comments to disabled warnings * Remove a few unused parameters * Replace MmeShadowScratch with Array256 * Simplify properties and array initialization, Use const when possible, Remove trailing commas * Run dotnet format after rebase * Address IDE0251 warnings * Revert "Simplify properties and array initialization, Use const when possible, Remove trailing commas" This reverts commit 9462e4136c0a2100dc28b20cf9542e06790aa67e. * dotnet format whitespace after rebase * First dotnet format pass * Second dotnet format pass * Fix build issues * Fix StructArrayHelpers.cs * Apply suggestions from code review Co-authored-by: Ac_K * Fix return statements * Fix naming rule violations * Update src/Ryujinx.Common/Utilities/StreamUtils.cs Co-authored-by: Ac_K * Add trailing commas * Address review feedback * Address review feedback * Rename remaining type parameters to TKey and TValue * Fix manual formatting for logging levels * Fix spacing before comments --------- Co-authored-by: Ac_K --- src/Ryujinx.Common/Memory/ArrayPtr.cs | 16 +- .../Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs | 4 +- src/Ryujinx.Common/Memory/ByteMemoryPool.cs | 20 +- src/Ryujinx.Common/Memory/MemoryStreamManager.cs | 4 +- .../Memory/PartialUnmaps/NativeReaderWriterLock.cs | 19 +- .../Memory/PartialUnmaps/PartialUnmapState.cs | 8 +- .../Memory/PartialUnmaps/ThreadLocalMap.cs | 7 +- src/Ryujinx.Common/Memory/Ptr.cs | 12 +- src/Ryujinx.Common/Memory/SpanReader.cs | 20 +- src/Ryujinx.Common/Memory/SpanWriter.cs | 16 +- src/Ryujinx.Common/Memory/StructArrayHelpers.cs | 520 +++++++++++---------- .../Memory/StructByteArrayHelpers.cs | 12 +- 12 files changed, 332 insertions(+), 326 deletions(-) (limited to 'src/Ryujinx.Common/Memory') diff --git a/src/Ryujinx.Common/Memory/ArrayPtr.cs b/src/Ryujinx.Common/Memory/ArrayPtr.cs index 9e95f75e..0365a508 100644 --- a/src/Ryujinx.Common/Memory/ArrayPtr.cs +++ b/src/Ryujinx.Common/Memory/ArrayPtr.cs @@ -16,12 +16,12 @@ namespace Ryujinx.Common.Memory /// /// Null pointer. /// - public static ArrayPtr Null => new ArrayPtr() { _ptr = IntPtr.Zero }; + public static ArrayPtr Null => new() { _ptr = IntPtr.Zero }; /// /// True if the pointer is null, false otherwise. /// - public bool IsNull => _ptr == IntPtr.Zero; + public readonly bool IsNull => _ptr == IntPtr.Zero; /// /// Number of elements on the array. @@ -37,7 +37,7 @@ namespace Ryujinx.Common.Memory /// /// Index of the element /// Reference to the element at the given index - public ref T this[int index] => ref Unsafe.AsRef((T*)_ptr + index); + public readonly ref T this[int index] => ref Unsafe.AsRef((T*)_ptr + index); /// /// Creates a new array from a given reference. @@ -81,7 +81,7 @@ namespace Ryujinx.Common.Memory /// /// Index where the new array should start /// New array starting at the specified position - public ArrayPtr Slice(int start) => new ArrayPtr(ref this[start], Length - start); + public ArrayPtr Slice(int start) => new(ref this[start], Length - start); /// /// Gets a span from the array. @@ -93,19 +93,19 @@ namespace Ryujinx.Common.Memory /// Gets the array base pointer. /// /// Base pointer - public T* ToPointer() => (T*)_ptr; + public readonly T* ToPointer() => (T*)_ptr; - public override bool Equals(object obj) + public readonly override bool Equals(object obj) { return obj is ArrayPtr other && Equals(other); } - public bool Equals([AllowNull] ArrayPtr other) + public readonly bool Equals([AllowNull] ArrayPtr other) { return _ptr == other._ptr && Length == other.Length; } - public override int GetHashCode() + public readonly override int GetHashCode() { return HashCode.Combine(_ptr, Length); } diff --git a/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs b/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs index eda350bd..8f2a61c8 100644 --- a/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs +++ b/src/Ryujinx.Common/Memory/ByteMemoryPool.ByteMemoryPoolBuffer.cs @@ -30,7 +30,7 @@ namespace Ryujinx.Common.Memory get { byte[] array = _array; - + ObjectDisposedException.ThrowIf(array is null, this); return new Memory(array, 0, _length); @@ -40,7 +40,7 @@ namespace Ryujinx.Common.Memory public void Dispose() { var array = Interlocked.Exchange(ref _array, null); - + if (array != null) { ArrayPool.Shared.Return(array); diff --git a/src/Ryujinx.Common/Memory/ByteMemoryPool.cs b/src/Ryujinx.Common/Memory/ByteMemoryPool.cs index 2910f408..b63449f8 100644 --- a/src/Ryujinx.Common/Memory/ByteMemoryPool.cs +++ b/src/Ryujinx.Common/Memory/ByteMemoryPool.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Common.Memory /// public sealed partial class ByteMemoryPool { - private static readonly ByteMemoryPool _shared = new ByteMemoryPool(); + private static readonly ByteMemoryPool _shared = new(); /// /// Constructs a instance. Private to force access through @@ -27,7 +27,7 @@ namespace Ryujinx.Common.Memory /// /// Returns the maximum buffer size supported by this pool. /// - public int MaxBufferSize => Array.MaxLength; + public static int MaxBufferSize => Array.MaxLength; /// /// Rents a byte memory buffer from . @@ -36,7 +36,7 @@ namespace Ryujinx.Common.Memory /// The buffer's required length in bytes /// A wrapping the rented memory /// - public IMemoryOwner Rent(long length) + public static IMemoryOwner Rent(long length) => RentImpl(checked((int)length)); /// @@ -46,7 +46,7 @@ namespace Ryujinx.Common.Memory /// The buffer's required length in bytes /// A wrapping the rented memory /// - public IMemoryOwner Rent(ulong length) + public static IMemoryOwner Rent(ulong length) => RentImpl(checked((int)length)); /// @@ -56,7 +56,7 @@ namespace Ryujinx.Common.Memory /// The buffer's required length in bytes /// A wrapping the rented memory /// - public IMemoryOwner Rent(int length) + public static IMemoryOwner Rent(int length) => RentImpl(length); /// @@ -66,7 +66,7 @@ namespace Ryujinx.Common.Memory /// The buffer's required length in bytes /// A wrapping the rented memory /// - public IMemoryOwner RentCleared(long length) + public static IMemoryOwner RentCleared(long length) => RentCleared(checked((int)length)); /// @@ -76,7 +76,7 @@ namespace Ryujinx.Common.Memory /// The buffer's required length in bytes /// A wrapping the rented memory /// - public IMemoryOwner RentCleared(ulong length) + public static IMemoryOwner RentCleared(ulong length) => RentCleared(checked((int)length)); /// @@ -86,12 +86,12 @@ namespace Ryujinx.Common.Memory /// The buffer's required length in bytes /// A wrapping the rented memory /// - public IMemoryOwner RentCleared(int length) + public static IMemoryOwner RentCleared(int length) { var buffer = RentImpl(length); - + buffer.Memory.Span.Clear(); - + return buffer; } diff --git a/src/Ryujinx.Common/Memory/MemoryStreamManager.cs b/src/Ryujinx.Common/Memory/MemoryStreamManager.cs index 68b82999..cc3a5968 100644 --- a/src/Ryujinx.Common/Memory/MemoryStreamManager.cs +++ b/src/Ryujinx.Common/Memory/MemoryStreamManager.cs @@ -5,7 +5,7 @@ namespace Ryujinx.Common.Memory { public static class MemoryStreamManager { - private static readonly RecyclableMemoryStreamManager _shared = new RecyclableMemoryStreamManager(); + private static readonly RecyclableMemoryStreamManager _shared = new(); /// /// We don't expose the RecyclableMemoryStreamManager directly because version 2.x @@ -19,7 +19,7 @@ namespace Ryujinx.Common.Memory /// /// A RecyclableMemoryStream public static RecyclableMemoryStream GetStream() - => new RecyclableMemoryStream(_shared); + => new(_shared); /// /// Retrieve a new MemoryStream object with the contents copied from the provided diff --git a/src/Ryujinx.Common/Memory/PartialUnmaps/NativeReaderWriterLock.cs b/src/Ryujinx.Common/Memory/PartialUnmaps/NativeReaderWriterLock.cs index 78eeb16f..03d48fd8 100644 --- a/src/Ryujinx.Common/Memory/PartialUnmaps/NativeReaderWriterLock.cs +++ b/src/Ryujinx.Common/Memory/PartialUnmaps/NativeReaderWriterLock.cs @@ -1,6 +1,5 @@ using System.Runtime.InteropServices; using System.Threading; - using static Ryujinx.Common.Memory.PartialUnmaps.PartialUnmapHelpers; namespace Ryujinx.Common.Memory.PartialUnmaps @@ -14,15 +13,15 @@ namespace Ryujinx.Common.Memory.PartialUnmaps public int WriteLock; public int ReaderCount; - public static int WriteLockOffset; - public static int ReaderCountOffset; + public static readonly int WriteLockOffset; + public static readonly int ReaderCountOffset; /// /// Populates the field offsets for use when emitting native code. /// static NativeReaderWriterLock() { - NativeReaderWriterLock instance = new NativeReaderWriterLock(); + NativeReaderWriterLock instance = new(); WriteLockOffset = OffsetOf(ref instance, ref instance.WriteLock); ReaderCountOffset = OffsetOf(ref instance, ref instance.ReaderCount); @@ -35,7 +34,9 @@ namespace Ryujinx.Common.Memory.PartialUnmaps { // Must take write lock for a very short time to become a reader. - while (Interlocked.CompareExchange(ref WriteLock, 1, 0) != 0) { } + while (Interlocked.CompareExchange(ref WriteLock, 1, 0) != 0) + { + } Interlocked.Increment(ref ReaderCount); @@ -60,11 +61,15 @@ namespace Ryujinx.Common.Memory.PartialUnmaps Interlocked.Decrement(ref ReaderCount); - while (Interlocked.CompareExchange(ref WriteLock, 1, 0) != 0) { } + while (Interlocked.CompareExchange(ref WriteLock, 1, 0) != 0) + { + } // Wait for reader count to drop to 0, then take the lock again as the only reader. - while (Interlocked.CompareExchange(ref ReaderCount, 1, 0) != 0) { } + while (Interlocked.CompareExchange(ref ReaderCount, 1, 0) != 0) + { + } } /// diff --git a/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs b/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs index 5b0bc07e..a583930b 100644 --- a/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs +++ b/src/Ryujinx.Common/Memory/PartialUnmaps/PartialUnmapState.cs @@ -1,10 +1,8 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Runtime.InteropServices.Marshalling; using System.Runtime.Versioning; using System.Threading; - using static Ryujinx.Common.Memory.PartialUnmaps.PartialUnmapHelpers; namespace Ryujinx.Common.Memory.PartialUnmaps @@ -35,7 +33,7 @@ namespace Ryujinx.Common.Memory.PartialUnmaps [SupportedOSPlatform("windows")] [LibraryImport("kernel32.dll", SetLastError = true)] - [return: MarshalAs (UnmanagedType.Bool)] + [return: MarshalAs(UnmanagedType.Bool)] private static partial bool CloseHandle(IntPtr hObject); [SupportedOSPlatform("windows")] @@ -48,7 +46,7 @@ namespace Ryujinx.Common.Memory.PartialUnmaps /// static unsafe PartialUnmapState() { - PartialUnmapState instance = new PartialUnmapState(); + PartialUnmapState instance = new(); PartialUnmapLockOffset = OffsetOf(ref instance, ref instance.PartialUnmapLock); PartialUnmapsCountOffset = OffsetOf(ref instance, ref instance.PartialUnmapsCount); @@ -160,4 +158,4 @@ namespace Ryujinx.Common.Memory.PartialUnmaps } } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs b/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs index a3bd5be8..a3c3dc57 100644 --- a/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs +++ b/src/Ryujinx.Common/Memory/PartialUnmaps/ThreadLocalMap.cs @@ -1,6 +1,5 @@ using System.Runtime.InteropServices; using System.Threading; - using static Ryujinx.Common.Memory.PartialUnmaps.PartialUnmapHelpers; namespace Ryujinx.Common.Memory.PartialUnmaps @@ -18,15 +17,15 @@ namespace Ryujinx.Common.Memory.PartialUnmaps public Array20 ThreadIds; public Array20 Structs; - public static int ThreadIdsOffset; - public static int StructsOffset; + public static readonly int ThreadIdsOffset; + public static readonly int StructsOffset; /// /// Populates the field offsets for use when emitting native code. /// static ThreadLocalMap() { - ThreadLocalMap instance = new ThreadLocalMap(); + ThreadLocalMap instance = new(); ThreadIdsOffset = OffsetOf(ref instance, ref instance.ThreadIds); StructsOffset = OffsetOf(ref instance, ref instance.Structs); diff --git a/src/Ryujinx.Common/Memory/Ptr.cs b/src/Ryujinx.Common/Memory/Ptr.cs index 66bcf569..5285d756 100644 --- a/src/Ryujinx.Common/Memory/Ptr.cs +++ b/src/Ryujinx.Common/Memory/Ptr.cs @@ -15,17 +15,17 @@ namespace Ryujinx.Common.Memory /// /// Null pointer. /// - public static Ptr Null => new Ptr() { _ptr = IntPtr.Zero }; + public static Ptr Null => new() { _ptr = IntPtr.Zero }; /// /// True if the pointer is null, false otherwise. /// - public bool IsNull => _ptr == IntPtr.Zero; + public readonly bool IsNull => _ptr == IntPtr.Zero; /// /// Gets a reference to the value. /// - public ref T Value => ref Unsafe.AsRef((void*)_ptr); + public readonly ref T Value => ref Unsafe.AsRef((void*)_ptr); /// /// Creates a new pointer to an unmanaged resource. @@ -40,17 +40,17 @@ namespace Ryujinx.Common.Memory _ptr = (IntPtr)Unsafe.AsPointer(ref value); } - public override bool Equals(object obj) + public readonly override bool Equals(object obj) { return obj is Ptr other && Equals(other); } - public bool Equals([AllowNull] Ptr other) + public readonly bool Equals([AllowNull] Ptr other) { return _ptr == other._ptr; } - public override int GetHashCode() + public readonly override int GetHashCode() { return _ptr.GetHashCode(); } diff --git a/src/Ryujinx.Common/Memory/SpanReader.cs b/src/Ryujinx.Common/Memory/SpanReader.cs index 9a1a0a3f..946439e3 100644 --- a/src/Ryujinx.Common/Memory/SpanReader.cs +++ b/src/Ryujinx.Common/Memory/SpanReader.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Common.Memory { private ReadOnlySpan _input; - public int Length => _input.Length; + public readonly int Length => _input.Length; public SpanReader(ReadOnlySpan input) { @@ -19,7 +19,7 @@ namespace Ryujinx.Common.Memory { T value = MemoryMarshal.Cast(_input)[0]; - _input = _input.Slice(Unsafe.SizeOf()); + _input = _input[Unsafe.SizeOf()..]; return value; } @@ -37,16 +37,16 @@ namespace Ryujinx.Common.Memory value = MemoryMarshal.Cast(_input)[0]; - _input = _input.Slice(valueSize); + _input = _input[valueSize..]; return true; } public ReadOnlySpan GetSpan(int size) { - ReadOnlySpan data = _input.Slice(0, size); + ReadOnlySpan data = _input[..size]; - _input = _input.Slice(size); + _input = _input[size..]; return data; } @@ -56,19 +56,19 @@ namespace Ryujinx.Common.Memory return GetSpan((int)Math.Min((uint)_input.Length, (uint)size)); } - public T ReadAt(int offset) where T : unmanaged + public readonly T ReadAt(int offset) where T : unmanaged { - return MemoryMarshal.Cast(_input.Slice(offset))[0]; + return MemoryMarshal.Cast(_input[offset..])[0]; } - public ReadOnlySpan GetSpanAt(int offset, int size) + public readonly ReadOnlySpan GetSpanAt(int offset, int size) { return _input.Slice(offset, size); } public void Skip(int size) { - _input = _input.Slice(size); + _input = _input[size..]; } } -} \ No newline at end of file +} diff --git a/src/Ryujinx.Common/Memory/SpanWriter.cs b/src/Ryujinx.Common/Memory/SpanWriter.cs index 5c35569d..248acc42 100644 --- a/src/Ryujinx.Common/Memory/SpanWriter.cs +++ b/src/Ryujinx.Common/Memory/SpanWriter.cs @@ -8,7 +8,7 @@ namespace Ryujinx.Common.Memory { private Span _output; - public int Length => _output.Length; + public readonly int Length => _output.Length; public SpanWriter(Span output) { @@ -18,28 +18,28 @@ namespace Ryujinx.Common.Memory public void Write(T value) where T : unmanaged { MemoryMarshal.Cast(_output)[0] = value; - _output = _output.Slice(Unsafe.SizeOf()); + _output = _output[Unsafe.SizeOf()..]; } public void Write(ReadOnlySpan data) { - data.CopyTo(_output.Slice(0, data.Length)); - _output = _output.Slice(data.Length); + data.CopyTo(_output[..data.Length]); + _output = _output[data.Length..]; } - public void WriteAt(int offset, T value) where T : unmanaged + public readonly void WriteAt(int offset, T value) where T : unmanaged { - MemoryMarshal.Cast(_output.Slice(offset))[0] = value; + MemoryMarshal.Cast(_output[offset..])[0] = value; } - public void WriteAt(int offset, ReadOnlySpan data) + public readonly void WriteAt(int offset, ReadOnlySpan data) { data.CopyTo(_output.Slice(offset, data.Length)); } public void Skip(int size) { - _output = _output.Slice(size); + _output = _output[size..]; } } } diff --git a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs index a039d04e..ae5853d1 100644 --- a/src/Ryujinx.Common/Memory/StructArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructArrayHelpers.cs @@ -1,654 +1,658 @@ using System; using System.Runtime.InteropServices; +#pragma warning disable CS0169, IDE0051 // Remove unused private member namespace Ryujinx.Common.Memory { public struct Array1 : IArray where T : unmanaged { T _e0; - public int Length => 1; + public readonly int Length => 1; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 1); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array2 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array1 _other; -#pragma warning restore CS0169 - public int Length => 2; + public readonly int Length => 2; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 2); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array3 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array2 _other; -#pragma warning restore CS0169 - public int Length => 3; + public readonly int Length => 3; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 3); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array4 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array3 _other; -#pragma warning restore CS0169 - public int Length => 4; + public readonly int Length => 4; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 4); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array5 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array4 _other; -#pragma warning restore CS0169 - public int Length => 5; + public readonly int Length => 5; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 5); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array6 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array5 _other; -#pragma warning restore CS0169 - public int Length => 6; + public readonly int Length => 6; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 6); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array7 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array6 _other; -#pragma warning restore CS0169 - public int Length => 7; + public readonly int Length => 7; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 7); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array8 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array7 _other; -#pragma warning restore CS0169 - public int Length => 8; + public readonly int Length => 8; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 8); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array9 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array8 _other; -#pragma warning restore CS0169 - public int Length => 9; + public readonly int Length => 9; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 9); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array10 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array9 _other; -#pragma warning restore CS0169 - public int Length => 10; + public readonly int Length => 10; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 10); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array11 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array10 _other; -#pragma warning restore CS0169 - public int Length => 11; + public readonly int Length => 11; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 11); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array12 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array11 _other; -#pragma warning restore CS0169 - public int Length => 12; + public readonly int Length => 12; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 12); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array13 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array12 _other; -#pragma warning restore CS0169 - public int Length => 13; + public readonly int Length => 13; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 13); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array14 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array13 _other; -#pragma warning restore CS0169 - public int Length => 14; + public readonly int Length => 14; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 14); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array15 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array14 _other; -#pragma warning restore CS0169 - public int Length => 15; + public readonly int Length => 15; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 15); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array16 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array15 _other; -#pragma warning restore CS0169 - public int Length => 16; + public readonly int Length => 16; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 16); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array17 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array16 _other; -#pragma warning restore CS0169 - public int Length => 17; + public readonly int Length => 17; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 17); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array18 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array17 _other; -#pragma warning restore CS0169 - public int Length => 18; + public readonly int Length => 18; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 18); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array19 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array18 _other; -#pragma warning restore CS0169 - public int Length => 19; + public readonly int Length => 19; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 19); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array20 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array19 _other; -#pragma warning restore CS0169 - public int Length => 20; + public readonly int Length => 20; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 20); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array21 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array20 _other; -#pragma warning restore CS0169 - public int Length => 21; + public readonly int Length => 21; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 21); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array22 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array21 _other; -#pragma warning restore CS0169 - public int Length => 22; + public readonly int Length => 22; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 22); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array23 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array22 _other; -#pragma warning restore CS0169 - public int Length => 23; + public readonly int Length => 23; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 23); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array24 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array23 _other; -#pragma warning restore CS0169 - public int Length => 24; + + public readonly int Length => 24; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 24); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array25 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array24 _other; -#pragma warning restore CS0169 - public int Length => 25; + + public readonly int Length => 25; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 25); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array26 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array25 _other; -#pragma warning restore CS0169 - public int Length => 26; + + public readonly int Length => 26; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 26); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array27 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array26 _other; -#pragma warning restore CS0169 - public int Length => 27; + + public readonly int Length => 27; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 27); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array28 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array27 _other; -#pragma warning restore CS0169 - public int Length => 28; + + public readonly int Length => 28; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 28); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array29 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array28 _other; -#pragma warning restore CS0169 - public int Length => 29; + + public readonly int Length => 29; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 29); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array30 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array29 _other; -#pragma warning restore CS0169 - public int Length => 30; + + public readonly int Length => 30; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 30); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array31 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array30 _other; -#pragma warning restore CS0169 - public int Length => 31; + + public readonly int Length => 31; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 31); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array32 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array31 _other; -#pragma warning restore CS0169 - public int Length => 32; + + public readonly int Length => 32; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 32); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array33 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array32 _other; -#pragma warning restore CS0169 - public int Length => 33; + + public readonly int Length => 33; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 33); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array34 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array33 _other; -#pragma warning restore CS0169 - public int Length => 34; + + public readonly int Length => 34; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 34); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array35 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array34 _other; -#pragma warning restore CS0169 - public int Length => 35; + + public readonly int Length => 35; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 35); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array36 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array35 _other; -#pragma warning restore CS0169 - public int Length => 36; + + public readonly int Length => 36; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 36); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array37 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array36 _other; -#pragma warning restore CS0169 - public int Length => 37; + + public readonly int Length => 37; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 37); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array38 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array37 _other; -#pragma warning restore CS0169 - public int Length => 38; + + public readonly int Length => 38; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 38); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array39 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array38 _other; -#pragma warning restore CS0169 - public int Length => 39; + + public readonly int Length => 39; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 39); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array40 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array39 _other; -#pragma warning restore CS0169 - public int Length => 40; + + public readonly int Length => 40; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 40); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array41 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array40 _other; -#pragma warning restore CS0169 - public int Length => 41; + + public readonly int Length => 41; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 41); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array42 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array41 _other; -#pragma warning restore CS0169 - public int Length => 42; + + public readonly int Length => 42; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 42); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array43 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array42 _other; -#pragma warning restore CS0169 - public int Length => 43; + + public readonly int Length => 43; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 43); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array44 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array43 _other; -#pragma warning restore CS0169 - public int Length => 44; + + public readonly int Length => 44; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 44); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array45 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array44 _other; -#pragma warning restore CS0169 - public int Length => 45; + + public readonly int Length => 45; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 45); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array46 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array45 _other; -#pragma warning restore CS0169 - public int Length => 46; + + public readonly int Length => 46; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 46); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array47 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array46 _other; -#pragma warning restore CS0169 - public int Length => 47; + + public readonly int Length => 47; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 47); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array48 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array47 _other; -#pragma warning restore CS0169 - public int Length => 48; + + public readonly int Length => 48; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 48); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array49 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array48 _other; -#pragma warning restore CS0169 - public int Length => 49; + + public readonly int Length => 49; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 49); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array50 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array49 _other; -#pragma warning restore CS0169 - public int Length => 50; + + public readonly int Length => 50; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 50); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array51 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array50 _other; -#pragma warning restore CS0169 - public int Length => 51; + + public readonly int Length => 51; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 51); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array52 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array51 _other; -#pragma warning restore CS0169 - public int Length => 52; + + public readonly int Length => 52; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 52); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array53 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array52 _other; -#pragma warning restore CS0169 - public int Length => 53; + + public readonly int Length => 53; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 53); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array54 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array53 _other; -#pragma warning restore CS0169 - public int Length => 54; + + public readonly int Length => 54; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 54); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array55 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array54 _other; -#pragma warning restore CS0169 - public int Length => 55; + + public readonly int Length => 55; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 55); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array56 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array55 _other; -#pragma warning restore CS0169 - public int Length => 56; + + public readonly int Length => 56; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 56); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array57 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array56 _other; -#pragma warning restore CS0169 - public int Length => 57; + + public readonly int Length => 57; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 57); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array58 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array57 _other; -#pragma warning restore CS0169 - public int Length => 58; + + public readonly int Length => 58; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 58); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array59 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array58 _other; -#pragma warning restore CS0169 - public int Length => 59; + + public readonly int Length => 59; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 59); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array60 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array59 _other; -#pragma warning restore CS0169 - public int Length => 60; + public readonly int Length => 60; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 60); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array61 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array60 _other; -#pragma warning restore CS0169 - public int Length => 61; + public readonly int Length => 61; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 61); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array62 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array61 _other; -#pragma warning restore CS0169 - public int Length => 62; + public readonly int Length => 62; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 62); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array63 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array62 _other; -#pragma warning restore CS0169 - public int Length => 63; + public readonly int Length => 63; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 63); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array64 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array63 _other; -#pragma warning restore CS0169 - public int Length => 64; + public readonly int Length => 64; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 64); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } + public struct Array73 : IArray where T : unmanaged { -#pragma warning disable CS0169 T _e0; Array64 _other; Array8 _other2; -#pragma warning restore CS0169 - public int Length => 73; + public readonly int Length => 73; + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + } + + public struct Array127 : IArray where T : unmanaged + { + T _e0; + Array64 _other; + Array62 _other2; + public readonly int Length => 127; + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + } + + public struct Array128 : IArray where T : unmanaged + { + T _e0; + Array64 _other; + Array63 _other2; + public readonly int Length => 128; + public ref T this[int index] => ref AsSpan()[index]; + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); + } + + public struct Array256 : IArray where T : unmanaged + { + T _e0; + Array128 _other; + Array127 _other2; + public readonly int Length => 256; public ref T this[int index] => ref AsSpan()[index]; - public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, 73); + public Span AsSpan() => MemoryMarshal.CreateSpan(ref _e0, Length); } } +#pragma warning restore CS0169, IDE0051 diff --git a/src/Ryujinx.Common/Memory/StructByteArrayHelpers.cs b/src/Ryujinx.Common/Memory/StructByteArrayHelpers.cs index 8693f5b8..f0f45273 100644 --- a/src/Ryujinx.Common/Memory/StructByteArrayHelpers.cs +++ b/src/Ryujinx.Common/Memory/StructByteArrayHelpers.cs @@ -10,7 +10,7 @@ namespace Ryujinx.Common.Memory byte _element; - public int Length => Size; + public readonly int Length => Size; public ref byte this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } @@ -22,7 +22,7 @@ namespace Ryujinx.Common.Memory byte _element; - public int Length => Size; + public readonly int Length => Size; public ref byte this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } @@ -34,7 +34,7 @@ namespace Ryujinx.Common.Memory byte _element; - public int Length => Size; + public readonly int Length => Size; public ref byte this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } @@ -46,7 +46,7 @@ namespace Ryujinx.Common.Memory byte _element; - public int Length => Size; + public readonly int Length => Size; public ref byte this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } @@ -58,7 +58,7 @@ namespace Ryujinx.Common.Memory byte _element; - public int Length => Size; + public readonly int Length => Size; public ref byte this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } @@ -70,7 +70,7 @@ namespace Ryujinx.Common.Memory byte _element; - public int Length => Size; + public readonly int Length => Size; public ref byte this[int index] => ref AsSpan()[index]; public Span AsSpan() => MemoryMarshal.CreateSpan(ref _element, Size); } -- cgit v1.2.3