Simplified a bit of code in JavaScript, TypeScript, Python.
This commit is contained in:
parent
a24466089b
commit
08886d2a3e
|
@ -997,8 +997,9 @@ var qrcodegen = new function() {
|
|||
data.forEach(function(b) {
|
||||
var factor = b ^ result.shift();
|
||||
result.push(0);
|
||||
for (var i = 0; i < result.length; i++)
|
||||
result[i] ^= ReedSolomonGenerator.multiply(coefficients[i], factor);
|
||||
coefficients.forEach(function(coef, i) {
|
||||
result[i] ^= ReedSolomonGenerator.multiply(coef, factor);
|
||||
});
|
||||
});
|
||||
return result;
|
||||
};
|
||||
|
|
|
@ -870,8 +870,8 @@ class _ReedSolomonGenerator(object):
|
|||
for b in data:
|
||||
factor = b ^ result.pop(0)
|
||||
result.append(0)
|
||||
for i in range(len(result)):
|
||||
result[i] ^= _ReedSolomonGenerator._multiply(self.coefficients[i], factor)
|
||||
for (i, coef) in enumerate(self.coefficients):
|
||||
result[i] ^= _ReedSolomonGenerator._multiply(coef, factor)
|
||||
return result
|
||||
|
||||
|
||||
|
|
|
@ -925,8 +925,8 @@ namespace qrcodegen {
|
|||
for (const b of data) {
|
||||
const factor: byte = b ^ (result.shift() as int);
|
||||
result.push(0);
|
||||
for (let i = 0; i < result.length; i++)
|
||||
result[i] ^= ReedSolomonGenerator.multiply(this.coefficients[i], factor);
|
||||
this.coefficients.forEach((coef, i) =>
|
||||
result[i] ^= ReedSolomonGenerator.multiply(coef, factor));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue