File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed
Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ pub fn spec(data: &mut &[u8]) -> Specification {
1717 if generate ( data, 0 , 1 ) == 1 {
1818 spec. check_trailing_bits = false ;
1919 }
20- if 8 % bit != 0 && generate ( data, 0 , 1 ) == 1 {
20+ if ! 8u8 . is_multiple_of ( bit ) && generate ( data, 0 , 1 ) == 1 {
2121 spec. padding = Some ( ascii. next_free ( data) ) ;
2222 }
2323 let ignore_translate_len = generate ( data, 0 , ascii. len_free ( ) ) ;
@@ -60,7 +60,7 @@ pub fn rev_spec(spec: &Specification) -> Vec<u8> {
6060 }
6161 output. push ( ( spec. bit_order == data_encoding:: BitOrder :: LeastSignificantFirst ) as u8 ) ;
6262 output. push ( !spec. check_trailing_bits as u8 ) ;
63- if 8 % bit != 0 {
63+ if ! 8u8 . is_multiple_of ( bit ) {
6464 output. push ( spec. padding . is_some ( ) as u8 ) ;
6565 if let Some ( pad) = spec. padding {
6666 output. push ( ascii. rev_free ( pad as u8 ) ) ;
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ pub fn encode(spec: &Specification, input: &[u8]) -> String {
1515 output. iter_mut ( ) . for_each ( |x| * x = symbols[ * x as usize ] ) ;
1616 // Pad to the next `dec(bit)` boundary, if needed.
1717 if let Some ( pad) = spec. padding {
18- while output. len ( ) % dec ( bit) != 0 {
18+ while ! output. len ( ) . is_multiple_of ( dec ( bit) ) {
1919 output. push ( pad as u8 ) ;
2020 }
2121 }
You can’t perform that action at this time.
0 commit comments