Tweaked a comment in QrCode.reedSolomonComputeDivisor() in 4 language versions.

pull/62/head
Project Nayuki 5 years ago
parent 76127b8bfe
commit b6aa563812

@ -693,7 +693,7 @@ var qrcodegen = new function() {
if (degree < 1 || degree > 255) if (degree < 1 || degree > 255)
throw "Degree out of range"; throw "Degree out of range";
// Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1. // Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}. // For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array [255, 8, 93].
var result = []; var result = [];
for (var i = 0; i < degree - 1; i++) for (var i = 0; i < degree - 1; i++)
result.push(0); result.push(0);

@ -570,7 +570,7 @@ class QrCode(object):
if degree < 1 or degree > 255: if degree < 1 or degree > 255:
raise ValueError("Degree out of range") raise ValueError("Degree out of range")
# Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1. # Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.
# For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}. # For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array [255, 8, 93].
result = [0] * (degree - 1) + [1] # Start off with the monomial x^0 result = [0] * (degree - 1) + [1] # Start off with the monomial x^0
# Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}), # Compute the product polynomial (x - r^0) * (x - r^1) * (x - r^2) * ... * (x - r^{degree-1}),

@ -778,7 +778,7 @@ impl QrCode {
fn reed_solomon_compute_divisor(degree: usize) -> Vec<u8> { fn reed_solomon_compute_divisor(degree: usize) -> Vec<u8> {
assert!(1 <= degree && degree <= 255, "Degree out of range"); assert!(1 <= degree && degree <= 255, "Degree out of range");
// Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1. // Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}. // For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array [255, 8, 93].
let mut result = vec![0u8; degree - 1]; let mut result = vec![0u8; degree - 1];
result.push(1); // Start off with the monomial x^0 result.push(1); // Start off with the monomial x^0

@ -639,7 +639,7 @@ namespace qrcodegen {
if (degree < 1 || degree > 255) if (degree < 1 || degree > 255)
throw "Degree out of range"; throw "Degree out of range";
// Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1. // Polynomial coefficients are stored from highest to lowest power, excluding the leading term which is always 1.
// For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array {255, 8, 93}. // For example the polynomial x^3 + 255x^2 + 8x + 93 is stored as the uint8 array [255, 8, 93].
let result: Array<byte> = []; let result: Array<byte> = [];
for (let i = 0; i < degree - 1; i++) for (let i = 0; i < degree - 1; i++)
result.push(0); result.push(0);

Loading…
Cancel
Save