diff --git a/tket2/src/passes/commutation.rs b/tket2/src/passes/commutation.rs index 66b8de7db..d5ae446f0 100644 --- a/tket2/src/passes/commutation.rs +++ b/tket2/src/passes/commutation.rs @@ -113,8 +113,7 @@ fn available_slice( ) -> Option<(usize, HashMap>)> { let mut available = None; let mut prev_nodes: HashMap> = HashMap::new(); - - for slice_index in (0..starting_index + 1).rev() { + for slice_index in (0..=starting_index).rev() { // if all qubit slots are empty here the command can be moved here if command .qubits() @@ -304,26 +303,25 @@ pub fn apply_greedy_commutation(circ: &mut Hugr) -> Result