acir/circuit/opcodes/
memory_operation.rsuse crate::native_types::{Expression, Witness};
use acir_field::AcirField;
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash, Copy, Default)]
#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
pub struct BlockId(pub u32);
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize, Debug, Hash)]
#[cfg_attr(feature = "arb", derive(proptest_derive::Arbitrary))]
pub struct MemOp<F> {
pub operation: Expression<F>,
pub index: Expression<F>,
pub value: Expression<F>,
}
impl<F: AcirField> MemOp<F> {
pub fn read_at_mem_index(index: Expression<F>, witness: Witness) -> Self {
MemOp { operation: Expression::zero(), index, value: witness.into() }
}
pub fn write_to_mem_index(index: Expression<F>, value: Expression<F>) -> Self {
MemOp { operation: Expression::one(), index, value }
}
}