mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-21 21:33:54 +00:00
Use standard algorithm.
This commit is contained in:
parent
3dcbb40c55
commit
0de7057d6f
@ -13,6 +13,8 @@
|
||||
|
||||
#include "Target.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace {
|
||||
|
||||
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;
|
||||
|
||||
// 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<uint8_t>(
|
||||
std::accumulate(boot_sector->samples[0].begin(), boot_sector->samples[0].end(), 0));
|
||||
return byte_sum == 3;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user