Skip to content

Commit bea35d3

Browse files
committed
save assignment
1 parent 07c01f9 commit bea35d3

File tree

6 files changed

+721
-691
lines changed

6 files changed

+721
-691
lines changed

bus-mapping/src/circuit_input_builder/execution.rs

+27-3
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,35 @@ impl_expr!(CopyDataType, u64::from);
350350
#[derive(Clone, Debug, PartialEq, Eq)]
351351
pub struct CopyStep {
352352
/// Byte value copied in this step.
353-
pub value: u8,
353+
pub half_word: [u8; 16],
354354
/// Byte value before this step.
355-
pub prev_value: u8,
355+
pub prev_half_word: [u8; 16],
356356
/// mask indicates this byte won't be copied.
357-
pub mask: bool,
357+
pub mask: [bool; 16],
358+
}
359+
360+
impl From<&[(u8, bool, bool)]> for CopyStep {
361+
fn from(steps: &[(u8, bool, bool)]) -> Self {
362+
assert_eq!(steps.len(), 16, "steps length should be 16");
363+
let bytes: [u8; 16] = steps
364+
.iter()
365+
.copied()
366+
.map(|(v, _, _)| v)
367+
.collect::<Vec<_>>()
368+
.try_into()
369+
.unwrap();
370+
Self {
371+
half_word: bytes,
372+
prev_half_word: bytes,
373+
mask: steps
374+
.iter()
375+
.copied()
376+
.map(|(_, _, m)| m)
377+
.collect::<Vec<_>>()
378+
.try_into()
379+
.unwrap(),
380+
}
381+
}
358382
}
359383

360384
/// Defines an enum type that can hold either a number or a hash value.

0 commit comments

Comments
 (0)