1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-26 03:29:40 +00:00

Implements write support for WOZ files.

This commit is contained in:
Thomas Harte
2018-05-24 21:44:31 -04:00
parent 4036c60b45
commit 523ca3264b
5 changed files with 86 additions and 9 deletions
+14
View File
@@ -10,6 +10,7 @@
#define CRC_hpp
#include <cstdint>
#include <vector>
namespace CRC {
@@ -58,6 +59,19 @@ template <typename T, T reset_value, T xor_output, bool reflect_input, bool refl
/// Sets the current value of the CRC.
inline void set_value(T value) { value_ = value; }
/*!
A compound for:
reset()
[add all data from @c data]
get_value()
*/
T compute_crc(const std::vector<uint8_t> &data) {
reset();
for(const auto &byte: data) add(byte);
return get_value();
}
private:
static constexpr int multibyte_shift = (sizeof(T) * 8) - 8;
T xor_table[256];