fn draw_format_bits(&mut self, mask: Mask) {
        // Calculate error correction code and pack bits
        let bits: u32 = {
            // errcorrlvl is uint2, mask is uint3
            let data: u32 = u32::from(self.errorcorrectionlevel.format_bits() << 3 | mask.value());
            let mut rem: u32 = data;
            for _ in 0..10 {
                rem = (rem << 1) ^ ((rem >> 9) * 0x537);
            }
            (data << 10 | rem) ^ 0x5412 // uint15
        };
        debug_assert_eq!(bits >> 15, 0);

        // Draw first copy
        for i in 0..6 {
            self.set_function_module(8, i, get_bit(bits, i));
        }
        self.set_function_module(8, 7, get_bit(bits, 6));
        self.set_function_module(8, 8, get_bit(bits, 7));
        self.set_function_module(7, 8, get_bit(bits, 8));
        for i in 9..15 {
            self.set_function_module(14 - i, 8, get_bit(bits, i));
        }

        // Draw second copy
        let size: i32 = self.size;
        for i in 0..8 {
            self.set_function_module(size - 1 - i, 8, get_bit(bits, i));
        }
        for i in 8..15 {
            self.set_function_module(8, size - 15 + i, get_bit(bits, i));
        }
        self.set_function_module(8, size - 8, true); // Always dark
    }
// Draws two copies of the format bits (with its own error correction code)
// based on the given mask and this object's error correction level field.
Draws two copies of the format bits (with its own error correction code)
based on the given mask and this object's error correction level field.
Draws two copies of the format bits ( with its own error correction code ) based on the given mask and this object ' s error correction level field .
fn draw_format_bits(&mut self, mask: Mask) {
        // Calculate error correction code and pack bits
        let bits: u32 = {
            // errcorrlvl is uint2, mask is uint3
            let data: u32 = u32::from(self.errorcorrectionlevel.format_bits() << 3 | mask.value());
            let mut rem: u32 = data;
            for _ in 0..10 {
                rem = (rem << 1) ^ ((rem >> 9) * 0x537);
            }
            (data << 10 | rem) ^ 0x5412 // uint15
        };
        debug_assert_eq!(bits >> 15, 0);
        // Draw first copy
        for i in 0..6 {
            self.set_function_module(8, i, get_bit(bits, i));
        }
        self.set_function_module(8, 7, get_bit(bits, 6));
        self.set_function_module(8, 8, get_bit(bits, 7));
        self.set_function_module(7, 8, get_bit(bits, 8));
        for i in 9..15 {
            self.set_function_module(14 - i, 8, get_bit(bits, i));
        }
        // Draw second copy
        let size: i32 = self.size;
        for i in 0..8 {
            self.set_function_module(size - 1 - i, 8, get_bit(bits, i));
        }
        for i in 8..15 {
            self.set_function_module(8, size - 15 + i, get_bit(bits, i));
        }
        self.set_function_module(8, size - 8, true); // Always dark
    }
fn draw_format_bits ( & mut self , mask : Mask ) { // Calculate error correction code and pack bits let bits : u32 = { // errcorrlvl is uint2, mask is uint3 let data : u32 = u32 :: from ( self . errorcorrectionlevel . format_bits ( ) << 3 | mask . value ( ) ) ; let mut rem : u32 = data ; for _ in 0 .. 10 { rem = ( rem << 1 ) ^ ( ( rem >> 9 ) * 0x537 ) ; } ( data << 10 | rem ) ^ 0x5412 // uint15 } ; debug_assert_eq ! ( bits 15 0 ) ; // Draw first copy for i in 0 .. 6 { self . set_function_module ( 8 , i , get_bit ( bits , i ) ) ; } self . set_function_module ( 8 , 7 , get_bit ( bits , 6 ) ) ; self . set_function_module ( 8 , 8 , get_bit ( bits , 7 ) ) ; self . set_function_module ( 7 , 8 , get_bit ( bits , 8 ) ) ; for i in 9 .. 15 { self . set_function_module ( 14 - i , 8 , get_bit ( bits , i ) ) ; } // Draw second copy let size : i32 = self . size ; for i in 0 .. 8 { self . set_function_module ( size - 1 - i , 8 , get_bit ( bits , i ) ) ; } for i in 8 .. 15 { self . set_function_module ( 8 , size - 15 + i , get_bit ( bits , i ) ) ; } self . set_function_module ( 8 , size - 8 , true ) ; // Always dark }
Draws two copies of the format bits (with its own error correction code)
based on the given mask and this object's error correction level field.
Draws two copies of the format bits ( with its own error correction code ) based on the given mask and this object ' s error correction level field .
&mut self
mask
Mask