From 0de7057d6f6be1c636cde23b9b57451ed15c5dc7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 20 Aug 2024 20:45:43 -0400 Subject: [PATCH] Use standard algorithm. --- Analyser/Static/ZXSpectrum/StaticAnalyser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp b/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp index 396c67f23..13a76841f 100644 --- a/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp +++ b/Analyser/Static/ZXSpectrum/StaticAnalyser.cpp @@ -13,6 +13,8 @@ #include "Target.hpp" +#include + namespace { bool IsSpectrumTape(const std::shared_ptr &tape) { @@ -47,10 +49,8 @@ bool IsSpectrumDisk(const std::shared_ptr &disk) { if(!boot_sector) return false; // Test that the contents of the boot sector sum to 3, modulo 256. - uint8_t byte_sum = 0; - for(auto byte: boot_sector->samples[0]) { - byte_sum += byte; - } + const auto byte_sum = static_cast( + std::accumulate(boot_sector->samples[0].begin(), boot_sector->samples[0].end(), 0)); return byte_sum == 3; }