Lines Matching +full:21 +full:- +full:k

1 // SPDX-License-Identifier: MIT
25 //! * <https://github.com/kennytm/qrcode-rust>
36 const P7: [u8; 7] = [87, 229, 146, 149, 238, 102, 21];
53 232, 87, 96, 227, 21,
56 173, 125, 158, 2, 103, 182, 118, 17, 145, 201, 111, 28, 165, 53, 161, 21, 245, 142, 13, 102,
60 168, 223, 200, 104, 224, 234, 108, 180, 110, 190, 195, 147, 205, 27, 232, 201, 21, 43, 245, 87,
69 /// - Error Correction polynomial.
70 /// - Number of blocks in group 1.
71 /// - Number of blocks in group 2.
72 /// - Block size in group 1.
166 /// Version information for format V7-V40.
211 fn from_segments(segments: &[&Segment<'_>]) -> Option<Version> { in from_segments()
212 for v in (1..=40).map(|k| Version(k)) { in from_segments()
220 fn width(&self) -> u8 { in width()
224 fn max_data(&self) -> usize { in max_data()
228 fn ec_size(&self) -> usize { in ec_size()
229 VPARAM[self.0 - 1].0.len() in ec_size()
232 fn g1_blocks(&self) -> usize { in g1_blocks()
233 VPARAM[self.0 - 1].1 as usize in g1_blocks()
236 fn g2_blocks(&self) -> usize { in g2_blocks()
237 VPARAM[self.0 - 1].2 as usize in g2_blocks()
240 fn g1_blk_size(&self) -> usize { in g1_blk_size()
241 VPARAM[self.0 - 1].3 as usize in g1_blk_size()
244 fn alignment_pattern(&self) -> &'static [u8] { in alignment_pattern()
245 &ALIGNMENT_PATTERNS[self.0 - 1] in alignment_pattern()
248 fn poly(&self) -> &'static [u8] { in poly()
249 VPARAM[self.0 - 1].0 in poly()
252 fn version_info(&self) -> u32 { in version_info()
254 VERSION_INFORMATION[self.0 - 7] in version_info()
269 151, 51, 102, 204, 133, 23, 46, 92, 184, 109, 218, 169, 79, 158, 33, 66, 132, 21, 42, 84, 168,
285 110, 107, 58, 40, 84, 250, 133, 186, 61, 202, 94, 155, 159, 10, 21, 121, 43, 78, 212, 229, 172,
303 fn get_next_13b(data: &[u8], offset: usize) -> Option<(u16, usize)> { in get_next_13b()
305 let size = cmp::min(13, data.len() * 8 - offset); in get_next_13b()
314 0..=8 => first_byte >> (8 - b), in get_next_13b()
315 9..=16 => (first_byte << (b - 8)) + (data[byte_off + 1] >> (16 - b)) as u16, in get_next_13b()
317 (first_byte << (b - 8)) in get_next_13b()
318 + ((data[byte_off + 1] as u16) << (b - 16)) in get_next_13b()
319 + (data[byte_off + 2] >> (24 - b)) as u16 in get_next_13b()
338 fn get_header(&self) -> (u16, usize) { in get_header()
346 fn length_bits_count(&self, version: Version) -> usize { in length_bits_count()
362 fn character_count(&self) -> usize { in character_count()
369 k => (k + 1) / 3, in character_count()
377 fn get_length_field(&self, version: Version) -> (u16, usize) { in get_length_field()
384 fn total_size_bits(&self, version: Version) -> usize { in total_size_bits()
396 fn iter(&self) -> SegmentIterator<'_> { in iter()
416 fn next(&mut self) -> Option<Self::Item> { in next()
437 k => (k + 1) / 3, in next()
440 self.carry_len = new_chars + self.carry_len - 3; in next()
442 self.carry * POW10[new_chars - self.carry_len] in next()
482 fn new<'a, 'b>(segments: &[&Segment<'b>], data: &'a mut [u8]) -> Option<EncodedMsg<'a>> { in new()
517 self.data[byte_off] = (number << (8 - b)) as u8; in push()
520 self.data[byte_off] = (number >> (b - 8)) as u8; in push()
521 self.data[byte_off + 1] = (number << (16 - b)) as u8; in push()
524 self.data[byte_off] |= (number << (8 - b)) as u8; in push()
527 self.data[byte_off] |= (number >> (b - 8)) as u8; in push()
528 self.data[byte_off + 1] = (number << (16 - b)) as u8; in push()
531 self.data[byte_off] |= (number >> (b - 8)) as u8; in push()
532 self.data[byte_off + 1] = (number >> (b - 16)) as u8; in push()
533 self.data[byte_off + 2] = (number << (24 - b)) as u8; in push()
596 fn iter(&self) -> EncodedMsgIterator<'_> { in iter()
615 fn next(&mut self) -> Option<Self::Item> { in next()
633 g1_end + em.g2_blk_size * (blk - em.g1_blocks) + blk_off in next()
637 let blk2 = self.offset - blocks * em.g1_blk_size; in next()
638 em.g1_blk_size * em.g1_blocks + blk2 * em.g2_blk_size + em.g2_blk_size - 1 in next()
641 let ec_offset = self.offset - g2_end; in next()
663 fn new<'a, 'b>(em: &'b EncodedMsg<'b>, qrdata: &'a mut [u8]) -> QrImage<'a> { in new()
698 for k in 0..size { in draw_square()
699 self.set(x + k, y); in draw_square()
700 self.set(x, y + k + 1); in draw_square()
701 self.set(x + size, y + k); in draw_square()
702 self.set(x + k + 1, y + size); in draw_square()
709 self.draw_square(self.width - 6, 1, 4); in draw_finders()
710 self.draw_square(1, self.width - 6, 4); in draw_finders()
711 for k in 0..8 { in draw_finders()
712 self.set(k, 7); in draw_finders()
713 self.set(self.width - k - 1, 7); in draw_finders()
714 self.set(k, self.width - 8); in draw_finders()
716 for k in 0..7 { in draw_finders()
717 self.set(7, k); in draw_finders()
718 self.set(self.width - 8, k); in draw_finders()
719 self.set(7, self.width - 1 - k); in draw_finders()
723 fn is_finder(&self, x: u8, y: u8) -> bool { in is_finder()
724 let end = self.width - 8; in is_finder()
734 self.draw_square(x - 1, y - 1, 2); in draw_alignments()
740 fn is_alignment(&self, x: u8, y: u8) -> bool { in is_alignment()
747 if x >= ax - 2 && x <= ax + 2 && y >= ay - 2 && y <= ay + 2 { in is_alignment()
757 let end = self.width - 8; in draw_timing_patterns()
765 fn is_timing(&self, x: u8, y: u8) -> bool { in is_timing()
774 for k in 0..7 { in draw_maskinfo()
775 if k == 6 { in draw_maskinfo()
778 if info & (1 << (14 - k)) == 0 { in draw_maskinfo()
779 self.set(k + skip, 8); in draw_maskinfo()
780 self.set(8, self.width - 1 - k); in draw_maskinfo()
784 for k in 0..8 { in draw_maskinfo()
785 if k == 2 { in draw_maskinfo()
788 if info & (1 << (7 - k)) == 0 { in draw_maskinfo()
789 self.set(8, 8 - skip - k); in draw_maskinfo()
790 self.set(self.width - 8 + k, 8); in draw_maskinfo()
795 fn is_maskinfo(&self, x: u8, y: u8) -> bool { in is_maskinfo()
796 let end = self.width - 8; in is_maskinfo()
804 let pos = self.width - 11; in draw_version_info()
818 fn is_version_info(&self, x: u8, y: u8) -> bool { in is_version_info()
820 let pos = self.width - 11; in is_version_info()
826 fn is_reserved(&self, x: u8, y: u8) -> bool { in is_reserved()
835 fn is_last(&self, x: u8, y: u8) -> bool { in is_last()
836 x == 0 && y == self.width - 1 in is_last()
841 fn next(&self, x: u8, y: u8) -> (u8, u8) { in next()
843 let column_type = (self.width - x_adj) % 4; in next()
846 2 if y > 0 => (x + 1, y - 1), in next()
847 0 if y < self.width - 1 => (x + 1, y + 1), in next()
848 0 | 2 if x == 7 => (x - 2, y), in next()
849 _ => (x - 1, y), in next()
854 fn next_available(&self, x: u8, y: u8) -> (u8, u8) { in next_available()
863 let (mut x, mut y) = (self.width - 1, self.width - 1); in draw_data()
882 // Apply checkerboard mask to all non-reserved modules.
927 /// * `url` must be null or point at a nul-terminated string.
941 ) -> u8 { in drm_panic_qr_generate()
961 // nul-terminated string. in drm_panic_qr_generate()
978 /// * `version`: QR code version, between 1-40.
985 pub extern "C" fn drm_panic_qr_max_data_size(version: u8, url_len: usize) -> usize { in drm_panic_qr_max_data_size()
996 let max = max_data - url_len - 5; in drm_panic_qr_max_data_size()
1001 max_data - 3 in drm_panic_qr_max_data_size()