fn reed_solomon_compute_divisor(degree: usize) -> Vec<u8> {
        assert!((1..=255).contains(&degree), "Degree out of range");
        // 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].
        let mut result = vec![0u8; degree - 1];
        result.push(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}),
        // and drop the highest monomial term which is always 1x^degree.
        // Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
        let mut root: u8 = 1;
        for _ in 0..degree {
            // Unused variable i
            // Multiply the current product by (x - r^i)
            for j in 0..degree {
                result[j] = QrCode::reed_solomon_multiply(result[j], root);
                if j + 1 < result.len() {
                    result[j] ^= result[j + 1];
                }
            }
            root = QrCode::reed_solomon_multiply(root, 0x02);
        }
        result
    }
// Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
// implemented as a lookup table over all possible parameter values, instead of as an algorithm.
Returns a Reed-Solomon ECC generator polynomial for the given degree. This could be
implemented as a lookup table over all possible parameter values, instead of as an algorithm.
Returns a Reed - Solomon ECC generator polynomial for the given degree . This could be implemented as a lookup table over all possible parameter values instead of as an algorithm .
fn reed_solomon_compute_divisor(degree: usize) -> Vec<u8> {
        assert!((1..=255).contains(&degree), "Degree out of range");
        // 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].
        let mut result = vec![0u8; degree - 1];
        result.push(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}),
        // and drop the highest monomial term which is always 1x^degree.
        // Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D).
        let mut root: u8 = 1;
        for _ in 0..degree {
            // Unused variable i
            // Multiply the current product by (x - r^i)
            for j in 0..degree {
                result[j] = QrCode::reed_solomon_multiply(result[j], root);
                if j + 1 < result.len() {
                    result[j] ^= result[j + 1];
                }
            }
            root = QrCode::reed_solomon_multiply(root, 0x02);
        }
        result
    }
fn reed_solomon_compute_divisor ( degree : usize ) -> Vec < u8 > { assert ! ( ( 1 255 ) contains ( degree ) " " ) ; // 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]. let mut result = vec ! [ 0u8 degree 1 ] ; result . push ( 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}), // and drop the highest monomial term which is always 1x^degree. // Note that r = 0x02, which is a generator element of this field GF(2^8/0x11D). let mut root : u8 = 1 ; for _ in 0 .. degree { // Unused variable i // Multiply the current product by (x - r^i) for j in 0 .. degree { result [ j ] = QrCode :: reed_solomon_multiply ( result [ j ] , root ) ; if j + 1 < result . len ( ) { result [ j ] ^= result [ j + 1 ] ; } } root = QrCode :: reed_solomon_multiply ( root , 0x02 ) ; } result }
Returns a Reed-Solomon ECC generator polynomial for the given degree.
Returns a Reed - Solomon ECC generator polynomial for the given degree .
degree
usize