1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Use standard algorithm.

This commit is contained in:
Thomas Harte 2024-08-20 20:45:43 -04:00
parent 3dcbb40c55
commit 0de7057d6f

View File

@ -13,6 +13,8 @@
#include "Target.hpp" #include "Target.hpp"
#include <algorithm>
namespace { namespace {
bool IsSpectrumTape(const std::shared_ptr<Storage::Tape::Tape> &tape) { bool IsSpectrumTape(const std::shared_ptr<Storage::Tape::Tape> &tape) {
@ -47,10 +49,8 @@ bool IsSpectrumDisk(const std::shared_ptr<Storage::Disk::Disk> &disk) {
if(!boot_sector) return false; if(!boot_sector) return false;
// Test that the contents of the boot sector sum to 3, modulo 256. // Test that the contents of the boot sector sum to 3, modulo 256.
uint8_t byte_sum = 0; const auto byte_sum = static_cast<uint8_t>(
for(auto byte: boot_sector->samples[0]) { std::accumulate(boot_sector->samples[0].begin(), boot_sector->samples[0].end(), 0));
byte_sum += byte;
}
return byte_sum == 3; return byte_sum == 3;
} }