From f748f93764f8cbce30fc421fd8a071acbb932b87 Mon Sep 17 00:00:00 2001 From: Morilli <35152647+Morilli@users.noreply.github.com> Date: Fri, 18 Oct 2024 04:10:00 +0200 Subject: [PATCH] simplify GetModChecksum256 --- src/BizHawk.Emulation.Common/DSKIdentifier.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/BizHawk.Emulation.Common/DSKIdentifier.cs b/src/BizHawk.Emulation.Common/DSKIdentifier.cs index 32b9153211..96fea2bb67 100644 --- a/src/BizHawk.Emulation.Common/DSKIdentifier.cs +++ b/src/BizHawk.Emulation.Common/DSKIdentifier.cs @@ -406,15 +406,7 @@ namespace BizHawk.Emulation.Common public byte[] SectorData { get; set; } public bool ContainsMultipleWeakSectors { get; set; } - public int GetModChecksum256() - { - int res = 0; - for (int i = 0; i < ActualDataByteLength; i++) - { - res = (res + SectorData[i]) % 256; - } - return res; - } + public byte GetModChecksum256() => (byte) (SectorData.Sum(static b => b) & 0xFF); } } }