use ark_ff::Field;
use o1_utils::FieldHelpers;
use super::{variables::Variables, WitnessCell};
pub struct CopyBitsCell {
row: usize,
col: usize,
start: usize, end: usize, }
impl CopyBitsCell {
pub fn create(row: usize, col: usize, start: usize, end: usize) -> Box<CopyBitsCell> {
Box::new(CopyBitsCell {
row,
col,
start,
end,
})
}
}
impl<F: Field, const W: usize> WitnessCell<F, F, W> for CopyBitsCell {
fn value(&self, witness: &mut [Vec<F>; W], _variables: &Variables<F>, _index: usize) -> F {
F::from_bits(&witness[self.col][self.row].to_bits()[self.start..self.end])
.expect("failed to deserialize field bits for copy bits cell")
}
}