Tweaked some Rust code for clarity, without changing behavior.
This commit is contained in:
parent
d9dca158e3
commit
6f5eccf2fc
|
@ -166,7 +166,7 @@ fn print_qr(qr: &QrCode) {
|
||||||
let border: i32 = 4;
|
let border: i32 = 4;
|
||||||
for y in -border .. qr.size() + border {
|
for y in -border .. qr.size() + border {
|
||||||
for x in -border .. qr.size() + border {
|
for x in -border .. qr.size() + border {
|
||||||
let c: char = if qr.get_module(x, y) { '\u{2588}' } else { ' ' };
|
let c: char = if qr.get_module(x, y) { '█' } else { ' ' };
|
||||||
print!("{0}{0}", c);
|
print!("{0}{0}", c);
|
||||||
}
|
}
|
||||||
println!();
|
println!();
|
||||||
|
|
|
@ -770,7 +770,7 @@ impl ReedSolomonGenerator {
|
||||||
fn new(degree: usize) -> ReedSolomonGenerator {
|
fn new(degree: usize) -> ReedSolomonGenerator {
|
||||||
assert!(1 <= degree && degree <= 255, "Degree out of range");
|
assert!(1 <= degree && degree <= 255, "Degree out of range");
|
||||||
// Start with the monomial x^0
|
// Start with the monomial x^0
|
||||||
let mut coefs = vec![0; degree - 1];
|
let mut coefs = vec![0u8; degree - 1];
|
||||||
coefs.push(1);
|
coefs.push(1);
|
||||||
|
|
||||||
// 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}),
|
||||||
|
|
Loading…
Reference in New Issue