|
|
|
@ -580,15 +580,15 @@ QrCode::ReedSolomonGenerator::ReedSolomonGenerator(int degree) :
|
|
|
|
|
// Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),
|
|
|
|
|
// drop the highest term, and store the rest of the coefficients in order of descending powers.
|
|
|
|
|
// Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
|
|
|
|
|
int root = 1;
|
|
|
|
|
uint8_t root = 1;
|
|
|
|
|
for (int i = 0; i < degree; i++) {
|
|
|
|
|
// Multiply the current product by (x - r^i)
|
|
|
|
|
for (size_t j = 0; j < coefficients.size(); j++) {
|
|
|
|
|
coefficients.at(j) = multiply(coefficients.at(j), static_cast<uint8_t>(root));
|
|
|
|
|
coefficients.at(j) = multiply(coefficients.at(j), root);
|
|
|
|
|
if (j + 1 < coefficients.size())
|
|
|
|
|
coefficients.at(j) ^= coefficients.at(j + 1);
|
|
|
|
|
}
|
|
|
|
|
root = (root << 1) ^ ((root >> 7) * 0x11D); // Multiply by 0x02 mod GF(2^8/0x11D)
|
|
|
|
|
root = multiply(root, 0x02);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|