File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed
src/r3_core/src/utils/binary_heap Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -16,20 +16,17 @@ fn interpret(bytecode: &[u8], max_len: usize) -> impl Iterator<Item = Cmd> + '_
16
16
let mut i = 0 ;
17
17
let mut len = 0 ;
18
18
std:: iter:: from_fn ( move || {
19
- if let Some ( instr) = bytecode. get ( i..i + 5 ) {
20
- i += 5 ;
19
+ let instr = bytecode. get ( i..i + 5 ) ? ;
20
+ i += 5 ;
21
21
22
- let value = u32:: from_le_bytes ( [ instr[ 1 ] , instr[ 2 ] , instr[ 3 ] , instr[ 4 ] ] ) as usize ;
22
+ let value = u32:: from_le_bytes ( [ instr[ 1 ] , instr[ 2 ] , instr[ 3 ] , instr[ 4 ] ] ) as usize ;
23
23
24
- if ( instr[ 0 ] % 2 == 0 && len != max_len) || len == 0 {
25
- len += 1 ;
26
- Some ( Cmd :: Insert ( value) )
27
- } else {
28
- len -= 1 ;
29
- Some ( Cmd :: Remove ( value % ( len + 1 ) ) )
30
- }
24
+ if ( instr[ 0 ] % 2 == 0 && len != max_len) || len == 0 {
25
+ len += 1 ;
26
+ Some ( Cmd :: Insert ( value) )
31
27
} else {
32
- None
28
+ len -= 1 ;
29
+ Some ( Cmd :: Remove ( value % ( len + 1 ) ) )
33
30
}
34
31
} )
35
32
}
You can’t perform that action at this time.
0 commit comments