@@ -197,10 +197,7 @@ impl<P: Fp384Parameters> Field for Fp384<P> {
197197 Self :: from_bigint ( two_inv) . unwrap ( ) // Guaranteed to be valid.
198198 }
199199
200- fn sum_of_products < ' a > (
201- a : impl Iterator < Item = & ' a Self > + Clone ,
202- b : impl Iterator < Item = & ' a Self > + Clone ,
203- ) -> Self {
200+ fn sum_of_products < ' a > ( a : & ' a [ Self ] , b : & ' a [ Self ] ) -> Self {
204201 // For a single `a x b` multiplication, operand scanning (schoolbook) takes each
205202 // limb of `a` in turn, and multiplies it by all of the limbs of `b` to compute
206203 // the result as a double-width intermediate representation, which is then fully
@@ -220,9 +217,8 @@ impl<P: Fp384Parameters> Field for Fp384<P> {
220217 let ( u0, u1, u2, u3, u4, u5) = ( 0 ..6 ) . fold ( ( 0 , 0 , 0 , 0 , 0 , 0 ) , |( u0, u1, u2, u3, u4, u5) , j| {
221218 // Algorithm 2, line 3
222219 // For each pair in the overall sum of products:
223- let ( t0, t1, t2, t3, t4, t5, mut t6) = a. clone ( ) . zip ( b. clone ( ) ) . fold (
224- ( u0, u1, u2, u3, u4, u5, 0 ) ,
225- |( t0, t1, t2, t3, t4, t5, mut t6) , ( a, b) | {
220+ let ( t0, t1, t2, t3, t4, t5, mut t6) =
221+ a. iter ( ) . zip ( b) . fold ( ( u0, u1, u2, u3, u4, u5, 0 ) , |( t0, t1, t2, t3, t4, t5, mut t6) , ( a, b) | {
226222 // Compute digit_j x row and accumulate into `u`.
227223 let mut carry = 0 ;
228224 let t0 = fa:: mac_with_carry ( t0, a. 0 . 0 [ j] , b. 0 . 0 [ 0 ] , & mut carry) ;
@@ -234,8 +230,7 @@ impl<P: Fp384Parameters> Field for Fp384<P> {
234230 let _ = fa:: adc ( & mut t6, 0 , carry) ;
235231
236232 ( t0, t1, t2, t3, t4, t5, t6)
237- } ,
238- ) ;
233+ } ) ;
239234
240235 // Algorithm 2, lines 4-5
241236 // This is a single step of the usual Montgomery reduction process.
0 commit comments