diff --git a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs index 98bb0a1547..ac9591a864 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor.rs @@ -457,10 +457,10 @@ impl Cairo1HintProcessor { remainder1: &CellRef, ) -> Result<(), HintError> { let pow_2_128 = BigUint::from(u128::MAX) + 1u32; - let dividend0 = get_val(vm, dividend0)?.to_biguint(); - let dividend1 = get_val(vm, dividend1)?.to_biguint(); - let divisor0 = get_val(vm, divisor0)?.to_biguint(); - let divisor1 = get_val(vm, divisor1)?.to_biguint(); + let dividend0 = res_operand_get_val(vm, dividend0)?.to_biguint(); + let dividend1 = res_operand_get_val(vm, dividend1)?.to_biguint(); + let divisor0 = res_operand_get_val(vm, divisor0)?.to_biguint(); + let divisor1 = res_operand_get_val(vm, divisor1)?.to_biguint(); let dividend: BigUint = dividend0 + dividend1.shl(128); let divisor = divisor0 + divisor1.shl(128); let (quotient, remainder) = dividend.div_rem(&divisor); @@ -1138,10 +1138,10 @@ impl Cairo1HintProcessor { t_or_k1: &CellRef, ) -> Result<(), HintError> { let pow_2_128 = BigInt::from(u128::MAX) + 1u32; - let b0 = get_val(vm, b0)?.to_bigint(); - let b1 = get_val(vm, b1)?.to_bigint(); - let n0 = get_val(vm, n0)?.to_bigint(); - let n1 = get_val(vm, n1)?.to_bigint(); + let b0 = res_operand_get_val(vm, b0)?.to_bigint(); + let b1 = res_operand_get_val(vm, b1)?.to_bigint(); + let n0 = res_operand_get_val(vm, n0)?.to_bigint(); + let n1 = res_operand_get_val(vm, n1)?.to_bigint(); let b: BigInt = b0.clone() + b1.clone().shl(128); let n: BigInt = n0 + n1.shl(128); let ExtendedGcd { diff --git a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor_utils.rs b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor_utils.rs index 46abef74e9..b4829be956 100644 --- a/vm/src/hint_processor/cairo_1_hint_processor/hint_processor_utils.rs +++ b/vm/src/hint_processor/cairo_1_hint_processor/hint_processor_utils.rs @@ -40,31 +40,6 @@ pub(crate) fn get_mayberelocatable( }) } -/// Fetches the value of `res_operand` from the vm. -pub(crate) fn get_val( - vm: &VirtualMachine, - res_operand: &ResOperand, -) -> Result { - match res_operand { - ResOperand::Deref(cell) => get_cell_val(vm, cell), - ResOperand::DoubleDeref(cell, offset) => { - get_double_deref_val(vm, cell, &Felt252::from(*offset as i32)) - } - ResOperand::Immediate(x) => Ok(Felt252::from(&x.value)), - ResOperand::BinOp(op) => { - let a = get_cell_val(vm, &op.a)?; - let b = match &op.b { - DerefOrImmediate::Deref(cell) => get_cell_val(vm, cell)?, - DerefOrImmediate::Immediate(x) => Felt252::from(&x.value), - }; - match op.op { - Operation::Add => Ok(a + b), - Operation::Mul => Ok(a * b), - } - } - } -} - pub(crate) fn cell_ref_to_relocatable( cell_ref: &CellRef, vm: &VirtualMachine,