A method for performing a temporary logical AND operation on two control qubits (702, 704), the method being implemented in a quantum device comprising a register of qubits, a plurality of control lines coupled to the register of qubits, a plurality of control devices, wherein each control device comprises one or more control circuits that are coupled to the plurality of control lines, the register of qubits comprising the two control qubits and an ancilla qubit having an initial state, the method comprising: computing, by at least one of the plurality of control devices, a logical-AND of the two control qubits and storing the computed logical-AND in the state of the ancilla qubit, thereby replacing the initial state of the ancilla qubit with the logical-AND of the two control qubits; using, by at least one of the plurality of control devices, the ancilla qubit storing the logical-AND of the two control bits as a control qubit for one or more additional operations; and erasing, by at least one of the plurality of control devices that includes at least one measurement device, the ancilla qubit, when the one or more additional operations have been performed, by applying a measure-and-correct process configured to un-compute the ancilla qubit; wherein computing the logical-AND of the two control qubits comprises applying one T gate (716, 718) to each of the two control qubits and applying one T gate to the ancilla qubit; and wherein the measure-and-correct process has a T gate count of zero and comprises: applying a Hadamard quantum logic gate to the ancilla qubit; measuring the ancilla qubit to generate a measurement result; in response to determining that the generated measurement result indicates that the two control qubits are both ON, applying a CZ gate to the two control qubits. computing, by at least one of the plurality of control devices, a logical-AND of the two control qubits and storing the computed logical-AND in the state of the ancilla qubit, thereby replacing the initial state of the ancilla qubit with the logical-AND of the two control qubits; using, by at least one of the plurality of control devices, the ancilla qubit storing the logical-AND of the two control bits as a control qubit for one or more additional operations; and erasing, by at least one of the plurality of control devices that includes at least one measurement device, the ancilla qubit, when the one or more additional operations have been performed, by applying a measure-and-correct process configured to un-compute the ancilla qubit; wherein computing the logical-AND of the two control qubits comprises applying one T gate (716, 718) to each of the two control qubits and applying one T gate to the ancilla qubit; and wherein the measure-and-correct process has a T gate count of zero and comprises: applying a Hadamard quantum logic gate to the ancilla qubit; measuring the ancilla qubit to generate a measurement result; in response to determining that the generated measurement result indicates that the two control qubits are both ON, applying a CZ gate to the two control qubits. applying a Hadamard quantum logic gate to the ancilla qubit; measuring the ancilla qubit to generate a measurement result; in response to determining that the generated measurement result indicates that the two control qubits are both ON, applying a CZ gate to the two control qubits.