diff --git a/Ryujinx.Audio/Helpers/TypeSize.cs b/Ryujinx.Audio/Helpers/TypeSize.cs deleted file mode 100644 index 5f041fb865..0000000000 --- a/Ryujinx.Audio/Helpers/TypeSize.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Reflection.Emit; - -namespace Ryujinx.Audio -{ - /// - /// Helper to determine the byte size of type - /// - public static class TypeSize - { - /// - /// The byte size of type - /// - public readonly static int Size; - - static TypeSize() - { - var dm = new DynamicMethod("", typeof(int), Type.EmptyTypes); - var il = dm.GetILGenerator(); - - il.Emit(OpCodes.Sizeof, typeof(T)); - il.Emit(OpCodes.Ret); - - Size = (int)dm.Invoke(null, null); - } - } -} diff --git a/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrack.cs b/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrack.cs index 61e918f661..de354a7b23 100644 --- a/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrack.cs +++ b/Ryujinx.Audio/Renderers/SoundIo/SoundIoAudioTrack.cs @@ -495,7 +495,7 @@ namespace Ryujinx.Audio.SoundIo return; // Calculate the size of the audio samples - var size = TypeSize.Size; + var size = Unsafe.SizeOf(); // Calculate the amount of bytes to copy from the buffer var bytesToCopy = size * buffer.Length;