frontend/zk_iriscode_ss/
decode.rs1pub fn decode_wirings(wirings_bytes: &[u8]) -> Vec<(u16, u16, u16, u16)> {
7 assert!(wirings_bytes.len().is_multiple_of(8)); wirings_bytes
10 .chunks_exact(8)
11 .map(|row_bytes| {
12 let a = u16::from_le_bytes(row_bytes[0..2].try_into().unwrap());
14 let b = u16::from_le_bytes(row_bytes[2..4].try_into().unwrap());
15 let c = u16::from_le_bytes(row_bytes[4..6].try_into().unwrap());
16 let d = u16::from_le_bytes(row_bytes[6..8].try_into().unwrap());
17 (a, b, c, d)
18 })
19 .collect()
20}
21
22pub fn decode_i32_array(bytes: &[u8]) -> Vec<i32> {
24 assert!(bytes.len().is_multiple_of(4)); bytes
26 .chunks_exact(4)
27 .map(|row_bytes| i32::from_le_bytes(row_bytes.try_into().unwrap()))
28 .collect()
29}
30
31pub fn decode_i64_array(bytes: &[u8]) -> Vec<i64> {
33 assert!(bytes.len().is_multiple_of(8)); bytes
35 .chunks_exact(8)
36 .map(|row_bytes| i64::from_le_bytes(row_bytes.try_into().unwrap()))
37 .collect()
38}