diff --git a/Ryujinx.Common/Utilities/Buffers.cs b/Ryujinx.Common/Utilities/Buffers.cs index 186cb4c76f..d614bfc43b 100644 --- a/Ryujinx.Common/Utilities/Buffers.cs +++ b/Ryujinx.Common/Utilities/Buffers.cs @@ -56,57 +56,4 @@ namespace Ryujinx.Common.Utilities return SpanHelpers.AsReadOnlySpan(ref Unsafe.AsRef(in this)); } } - - [DebuggerDisplay("{ToString()}")] - [StructLayout(LayoutKind.Sequential, Size = 20)] - public struct Buffer20 - { - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private ulong _dummy0; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private ulong _dummy1; - [DebuggerBrowsable(DebuggerBrowsableState.Never)] private uint _dummy3; - - public byte this[int i] - { - get => Bytes[i]; - set => Bytes[i] = value; - } - - public Span Bytes => SpanHelpers.AsByteSpan(ref this); - - // Prevent a defensive copy by changing the read-only in reference to a reference with Unsafe.AsRef() - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static implicit operator Span(in Buffer20 value) - { - return SpanHelpers.AsByteSpan(ref Unsafe.AsRef(in value)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static implicit operator ReadOnlySpan(in Buffer20 value) - { - return SpanHelpers.AsReadOnlyByteSpan(ref Unsafe.AsRef(in value)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref T As() where T : unmanaged - { - if (Unsafe.SizeOf() > (uint)Unsafe.SizeOf()) - { - throw new ArgumentException(); - } - - return ref MemoryMarshal.GetReference(AsSpan()); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public Span AsSpan() where T : unmanaged - { - return SpanHelpers.AsSpan(ref this); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly ReadOnlySpan AsReadOnlySpan() where T : unmanaged - { - return SpanHelpers.AsReadOnlySpan(ref Unsafe.AsRef(in this)); - } - } } diff --git a/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs b/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs index 4b820906fd..e6858e25bd 100644 --- a/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs +++ b/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs @@ -111,8 +111,7 @@ namespace Ryujinx.Graphics.Texture.Astc int numberBitsPerValue) { // Implement the algorithm in section C.2.12 - var mBuf = new Buffer20(); - Span m = mBuf.AsSpan(); + Span m = stackalloc int[5]; m[0] = bitStream.ReadBits(numberBitsPerValue); int encoded = bitStream.ReadBits(2);