File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -111,7 +111,7 @@ impl<const MAX_SIZE: usize> Encoder<MAX_SIZE> {
111
111
}
112
112
113
113
let mask = if remaining_len > 0 { 0b10000000 } else { 0 } ;
114
- let ( hi, lo) = split_high_bits ( n) ;
114
+ let ( hi, lo) = split_hi_bits ( n) ;
115
115
self . bytes [ self . cursor ] = hi | mask;
116
116
self . cursor = checked_add ! ( self . cursor, 1 ) ;
117
117
@@ -137,7 +137,7 @@ const fn base128_len(arc: Arc) -> usize {
137
137
///
138
138
/// Returns: `(hi, lo)`
139
139
#[ inline]
140
- const fn split_high_bits ( arc : Arc ) -> ( u8 , Arc ) {
140
+ const fn split_hi_bits ( arc : Arc ) -> ( u8 , Arc ) {
141
141
if arc < 0x80 {
142
142
return ( arc as u8 , 0 ) ;
143
143
}
@@ -173,6 +173,12 @@ mod tests {
173
173
/// OID `1.2.840.10045.2.1` encoded as ASN.1 BER/DER
174
174
const EXAMPLE_OID_BER : & [ u8 ] = & hex ! ( "2A8648CE3D0201" ) ;
175
175
176
+ #[ test]
177
+ fn split_hi_bits_with_gaps ( ) {
178
+ assert_eq ! ( super :: split_hi_bits( 0x3a00002 ) , ( 0x1d , 0x2 ) ) ;
179
+ assert_eq ! ( super :: split_hi_bits( 0x3a08000 ) , ( 0x1d , 0x8000 ) ) ;
180
+ }
181
+
176
182
#[ test]
177
183
fn encode ( ) {
178
184
let encoder = Encoder :: < 7 > :: new ( ) ;
You can’t perform that action at this time.
0 commit comments