From 2021a8f3a2e4d9f96f20b4d107e145a3951e2be8 Mon Sep 17 00:00:00 2001 From: benesjan Date: Fri, 3 Jan 2025 19:30:12 +0000 Subject: [PATCH] fix --- .../crates/types/src/type_serialization.nr | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr b/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr index 68300d1fd44..185d82f453f 100644 --- a/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr +++ b/noir-projects/noir-protocol-circuits/crates/types/src/type_serialization.nr @@ -166,19 +166,17 @@ impl Deserialize for i64 { } } -impl Serialize for [T; M] +impl Serialize for [T; N] where - T: Serialize, + T: Serialize, { - let N = M * O; - - fn serialize(self) -> [Field; Self::N] { - let mut result: [Field; Self::N] = std::mem::zeroed(); - let mut serialized: [Field; O] = std::mem::zeroed(); - for i in 0..M { + fn serialize(self) -> [Field; N * M] { + let mut result: [Field; N * M] = std::mem::zeroed(); + let mut serialized: [Field; M] = std::mem::zeroed(); + for i in 0..N { serialized = self[i].serialize(); - for j in 0..O { - result[i * O + j] = serialized[j]; + for j in 0..M { + result[i * M + j] = serialized[j]; } } result