From fc8fd641433011ee87e3fa2bbe0393085b810357 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Fri, 12 Jul 2024 14:17:12 +1000 Subject: [PATCH] Simplify `DiskBuilder.BamEntry.GetBytes` (C64Hawk) implementation --- .../Computers/Commodore64/Media/DiskBuilder.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/DiskBuilder.cs b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/DiskBuilder.cs index 968454eacc..a1bd044334 100644 --- a/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/DiskBuilder.cs +++ b/src/BizHawk.Emulation.Cores/Computers/Commodore64/Media/DiskBuilder.cs @@ -1,5 +1,5 @@ +using System.Buffers.Binary; using System.Collections.Generic; -using System.Linq; using System.Text; namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media @@ -82,15 +82,9 @@ namespace BizHawk.Emulation.Cores.Computers.Commodore64.Media public byte[] GetBytes() { - return GetBytesEnumerable().ToArray(); - } - - private IEnumerable GetBytesEnumerable() - { - yield return unchecked((byte)(Data >> 24)); - yield return unchecked((byte)(Data >> 16)); - yield return unchecked((byte)(Data >> 8)); - yield return unchecked((byte)Data); + var buf = new byte[sizeof(int)]; + BinaryPrimitives.WriteInt32BigEndian(buf, Data); + return buf; } public IEnumerable Entries