Skip to content

Commit

Permalink
Merge pull request #13 from noir-lang/tf/fix-bad-generics
Browse files Browse the repository at this point in the history
fix: remove unnecessary generic from `ArrayX.__normalize_limbs()`
  • Loading branch information
jfecher authored Aug 29, 2024
2 parents ac6951c + b5afd7b commit 5d3f013
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/runtime_bignum.nr
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ impl<let N: u32, Params> BigNum<N, Params> where Params: BigNumParamsTrait<N> {
}
}

impl<let N: u32, Params,> BigNumInstanceTrait<BigNum<N, Params>> for BigNumInstance<N, Params> where Params: BigNumParamsTrait<N> {
impl<let N: u32, Params> BigNumInstanceTrait<BigNum<N, Params>> for BigNumInstance<N, Params> where Params: BigNumParamsTrait<N> {

fn modulus(self) -> BigNum<N, Params> { BigNum{ limbs: self.modulus } }
fn __derive_from_seed<let SeedBytes: u32>(self, seed: [u8; SeedBytes]) -> BigNum<N, Params> {
Expand Down Expand Up @@ -1271,7 +1271,7 @@ impl<let N: u32, Params> BigNumInstance<N, Params> 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);
Expand Down Expand Up @@ -1373,7 +1373,7 @@ impl<let N: u32, Params> BigNumInstance<N, Params> where Params: BigNumParamsTra
linear_terms,
linear_flags
);
let mut mulout_n: ArrayX<Field, N,2> = ArrayX::new();
let mut mulout_n: ArrayX<Field, N, 2> = ArrayX::new();

let relation_result: ArrayX<Field, N, 2> = mulout_p.__normalize_limbs(N + N);
let modulus: [Field; N] = self.modulus;
Expand Down
9 changes: 6 additions & 3 deletions src/utils/arrayX.nr
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ impl<T, let N: u32, let SizeMultiplier: u32> ArrayX<T, N, SizeMultiplier> {
let index = i % N;
self.segments[segment][index]
}
}

impl<let N: u32, let SizeMultiplier: u32> ArrayX<Field, N, SizeMultiplier> {

unconstrained fn __normalize_limbs<let NumSegments: u32>(x: ArrayX<Field, N, NumSegments>, range: u32) -> ArrayX<Field, N, NumSegments> {
let mut normalized: ArrayX<Field, N, NumSegments> = 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
Expand Down

0 comments on commit 5d3f013

Please sign in to comment.