Lines Matching +full:carry +full:- +full:less
1 // SPDX-License-Identifier: MIT
21 //! binary data. This is the same algorithm used by Fido v2.2 QR-initiated
26 //! * <https://github.com/kennytm/qrcode-rust>
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()
217 fn width(&self) -> u8 { in width()
221 fn max_data(&self) -> usize { in max_data()
225 fn ec_size(&self) -> usize { in ec_size()
226 VPARAM[self.0 - 1].0.len() in ec_size()
229 fn g1_blocks(&self) -> usize { in g1_blocks()
230 VPARAM[self.0 - 1].1 as usize in g1_blocks()
233 fn g2_blocks(&self) -> usize { in g2_blocks()
234 VPARAM[self.0 - 1].2 as usize in g2_blocks()
237 fn g1_blk_size(&self) -> usize { in g1_blk_size()
238 VPARAM[self.0 - 1].3 as usize in g1_blk_size()
241 fn alignment_pattern(&self) -> &'static [u8] { in alignment_pattern()
242 ALIGNMENT_PATTERNS[self.0 - 1] in alignment_pattern()
245 fn poly(&self) -> &'static [u8] { in poly()
246 VPARAM[self.0 - 1].0 in poly()
249 fn version_info(&self) -> u32 { in version_info()
251 VERSION_INFORMATION[self.0 - 7] in version_info()
311 fn get_header(&self) -> (u16, usize) { in get_header()
319 fn length_bits_count(&self, version: Version) -> usize { in length_bits_count()
335 fn character_count(&self) -> usize { in character_count()
346 fn get_length_field(&self, version: Version) -> (u16, usize) { in get_length_field()
353 fn total_size_bits(&self, version: Version) -> usize { in total_size_bits()
365 fn iter(&self) -> SegmentIterator<'_> { in iter()
369 carry: 0, in iter()
378 carry: u64, field
385 fn next(&mut self) -> Option<Self::Item> { in next()
398 // If there are less than 3 decimal digits in the carry, in next()
399 // take the next 7 bytes of input, and add them to the carry. in next()
401 let len = 7.min(data.len() - self.offset); in next()
405 self.carry = chunk + self.carry * pow; in next()
412 // take the next 3 decimal digits of the carry in next()
415 self.carry_len -= out_len; in next()
417 let out = (self.carry / pow) as u16; in next()
418 self.carry = self.carry % pow; in next()
441 fn new<'a>(segments: &[&Segment<'_>], data: &'a mut [u8]) -> Option<EncodedMsg<'a>> { in new()
476 self.data[byte_off] = (number << (8 - b)) as u8; in push()
479 self.data[byte_off] = (number >> (b - 8)) as u8; in push()
480 self.data[byte_off + 1] = (number << (16 - b)) as u8; in push()
483 self.data[byte_off] |= (number << (8 - b)) as u8; in push()
486 self.data[byte_off] |= (number >> (b - 8)) as u8; in push()
487 self.data[byte_off + 1] = (number << (16 - b)) as u8; in push()
490 self.data[byte_off] |= (number >> (b - 8)) as u8; in push()
491 self.data[byte_off + 1] = (number >> (b - 16)) as u8; in push()
492 self.data[byte_off + 2] = (number << (24 - b)) as u8; in push()
555 fn iter(&self) -> EncodedMsgIterator<'_> { in iter()
574 fn next(&mut self) -> Option<Self::Item> { in next()
592 g1_end + em.g2_blk_size * (blk - em.g1_blocks) + blk_off in next()
596 let blk2 = self.offset - blocks * em.g1_blk_size; in next()
597 em.g1_blk_size * em.g1_blocks + blk2 * em.g2_blk_size + em.g2_blk_size - 1 in next()
600 let ec_offset = self.offset - g2_end; in next()
622 fn new<'a, 'b>(em: &'b EncodedMsg<'b>, qrdata: &'a mut [u8]) -> QrImage<'a> { in new()
668 self.draw_square(self.width - 6, 1, 4); in draw_finders()
669 self.draw_square(1, self.width - 6, 4); in draw_finders()
672 self.set(self.width - k - 1, 7); in draw_finders()
673 self.set(k, self.width - 8); in draw_finders()
677 self.set(self.width - 8, k); in draw_finders()
678 self.set(7, self.width - 1 - k); in draw_finders()
682 fn is_finder(&self, x: u8, y: u8) -> bool { in is_finder()
683 let end = self.width - 8; in is_finder()
696 self.draw_square(x - 1, y - 1, 2); in draw_alignments()
702 fn is_alignment(&self, x: u8, y: u8) -> bool { in is_alignment()
709 if x >= ax - 2 && x <= ax + 2 && y >= ay - 2 && y <= ay + 2 { in is_alignment()
719 let end = self.width - 8; in draw_timing_patterns()
727 fn is_timing(&self, x: u8, y: u8) -> bool { in is_timing()
740 if info & (1 << (14 - k)) == 0 { in draw_maskinfo()
742 self.set(8, self.width - 1 - k); in draw_maskinfo()
750 if info & (1 << (7 - k)) == 0 { in draw_maskinfo()
751 self.set(8, 8 - skip - k); in draw_maskinfo()
752 self.set(self.width - 8 + k, 8); in draw_maskinfo()
757 fn is_maskinfo(&self, x: u8, y: u8) -> bool { in is_maskinfo()
758 let end = self.width - 8; in is_maskinfo()
766 let pos = self.width - 11; in draw_version_info()
780 fn is_version_info(&self, x: u8, y: u8) -> bool { in is_version_info()
782 let pos = self.width - 11; in is_version_info()
788 fn is_reserved(&self, x: u8, y: u8) -> bool { in is_reserved()
797 fn is_last(&self, x: u8, y: u8) -> bool { in is_last()
798 x == 0 && y == self.width - 1 in is_last()
803 fn next(&self, x: u8, y: u8) -> (u8, u8) { in next()
805 let column_type = (self.width - x_adj) % 4; in next()
808 2 if y > 0 => (x + 1, y - 1), in next()
809 0 if y < self.width - 1 => (x + 1, y + 1), in next()
810 0 | 2 if x == 7 => (x - 2, y), in next()
811 _ => (x - 1, y), in next()
816 fn next_available(&self, x: u8, y: u8) -> (u8, u8) { in next_available()
825 let (mut x, mut y) = (self.width - 1, self.width - 1); in draw_data()
844 // Apply checkerboard mask to all non-reserved modules.
878 /// * `data_len`: Length of the data, that needs to be encoded, must be less
889 /// * `url` must be null or point at a nul-terminated string.
902 ) -> u8 { in drm_panic_qr_generate()
922 // nul-terminated string. in drm_panic_qr_generate()
939 /// * `version`: QR code version, between 1-40.
951 pub unsafe extern "C" fn drm_panic_qr_max_data_size(version: u8, url_len: usize) -> usize { in drm_panic_qr_max_data_size()
963 let max = max_data - url_len - 5; in drm_panic_qr_max_data_size()
968 max_data - 3 in drm_panic_qr_max_data_size()