From b5afd7b65b9e93a6932a1d9ae33cdc4472212db3 Mon Sep 17 00:00:00 2001 From: TomAFrench Date: Thu, 29 Aug 2024 18:20:38 +0000 Subject: [PATCH] fix: remove unnecessary generic from `ArrayX.__normalize_limbs()` --- src/runtime_bignum.nr | 6 +++--- src/utils/arrayX.nr | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/runtime_bignum.nr b/src/runtime_bignum.nr index c73be8b..a73f053 100644 --- a/src/runtime_bignum.nr +++ b/src/runtime_bignum.nr @@ -283,7 +283,7 @@ impl BigNum where Params: BigNumParamsTrait { } } -impl BigNumInstanceTrait> for BigNumInstance where Params: BigNumParamsTrait { +impl BigNumInstanceTrait> for BigNumInstance where Params: BigNumParamsTrait { fn modulus(self) -> BigNum { BigNum{ limbs: self.modulus } } fn __derive_from_seed(self, seed: [u8; SeedBytes]) -> BigNum { @@ -1271,7 +1271,7 @@ impl BigNumInstance where Params: BigNumParamsTra for i in 0..NUM_PRODUCTS { lhs[i] = self.__add_linear_expression(lhs_terms[i], lhs_flags[i]); - rhs[i]= self.__add_linear_expression(rhs_terms[i], rhs_flags[i]); + rhs[i] = self.__add_linear_expression(rhs_terms[i], rhs_flags[i]); } let add: [Field; N] = self.__add_linear_expression(linear_terms, linear_flags); @@ -1373,7 +1373,7 @@ impl BigNumInstance where Params: BigNumParamsTra linear_terms, linear_flags ); - let mut mulout_n: ArrayX = ArrayX::new(); + let mut mulout_n: ArrayX = ArrayX::new(); let relation_result: ArrayX = mulout_p.__normalize_limbs(N + N); let modulus: [Field; N] = self.modulus; diff --git a/src/utils/arrayX.nr b/src/utils/arrayX.nr index f3d9505..f34ec1e 100644 --- a/src/utils/arrayX.nr +++ b/src/utils/arrayX.nr @@ -74,10 +74,13 @@ impl ArrayX { let index = i % N; self.segments[segment][index] } +} + +impl ArrayX { - unconstrained fn __normalize_limbs(x: ArrayX, range: u32) -> ArrayX { - let mut normalized: ArrayX = ArrayX::new(); - let mut inp = x; + unconstrained fn __normalize_limbs(self, range: u32) -> Self { + let mut normalized: Self = ArrayX::new(); + let mut inp = self; // (9 limb mul = 17 product terms) // a2 a1 a0