File tree 3 files changed +3
-3
lines changed
3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -261,7 +261,7 @@ pub const fn encoded_len<T: Encoding>(length: usize) -> usize {
261
261
} else if T :: PADDED {
262
262
( ( length - 1 ) / 5 + 1 ) * 8
263
263
} else {
264
- ( length * 8 + 4 ) / 5
264
+ ( length * 8 ) . div_ceil ( 5 )
265
265
}
266
266
}
267
267
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ impl DeriveBitString {
100
100
min_expected_fields += 1 ;
101
101
}
102
102
}
103
- let max_expected_bytes = ( max_expected_fields + 7 ) / 8 ;
103
+ let max_expected_bytes = max_expected_fields. div_ceil ( 8 ) ;
104
104
105
105
for ( i, field) in self . fields . iter ( ) . enumerate ( ) . rev ( ) {
106
106
let field_name = & field. ident ;
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ impl AttributeTypeAndValue {
155
155
} ;
156
156
157
157
// Decode der bytes from hex.
158
- let mut bytes = Vec :: with_capacity ( ( val. len ( ) + 1 ) / 2 ) ;
158
+ let mut bytes = Vec :: with_capacity ( val. len ( ) . div_ceil ( 2 ) ) ;
159
159
160
160
while let ( Some ( h) , Some ( l) ) = ( iter. next ( ) , iter. next ( ) ) {
161
161
let mut byte = 0u8 ;
You can’t perform that action at this time.
0 commit comments