@@ -251,11 +251,8 @@ impl BoxedMontyForm {
251251 /// (since the modulus `p` in Montgomery form is always odd, this divides entirely).
252252 pub fn div_by_2 ( & self ) -> Self {
253253 Self {
254- montgomery_form : div_by_2:: boxed:: div_by_2 (
255- & self . montgomery_form ,
256- & self . residue_params . modulus ,
257- ) ,
258- residue_params : self . residue_params . clone ( ) , // TODO: avoid clone?
254+ montgomery_form : div_by_2:: boxed:: div_by_2 ( & self . montgomery_form , & self . params . modulus ) ,
255+ params : self . params . clone ( ) , // TODO: avoid clone?
259256 }
260257 }
261258}
@@ -279,7 +276,7 @@ fn convert_to_montgomery(integer: &mut BoxedUint, params: &BoxedMontyParams) {
279276
280277#[ cfg( test) ]
281278mod tests {
282- use super :: { BoxedMontyParams , BoxedUint } ;
279+ use super :: { BoxedMontyForm , BoxedMontyParams , BoxedUint } ;
283280
284281 #[ test]
285282 fn new_params_with_invalid_modulus ( ) {
@@ -299,9 +296,9 @@ mod tests {
299296
300297 #[ test]
301298 fn div_by_2 ( ) {
302- let params = BoxedResidueParams :: new ( BoxedUint :: from ( 9u8 ) ) . unwrap ( ) ;
303- let zero = BoxedResidue :: zero ( params. clone ( ) ) ;
304- let one = BoxedResidue :: one ( params. clone ( ) ) ;
299+ let params = BoxedMontyParams :: new ( BoxedUint :: from ( 9u8 ) ) . unwrap ( ) ;
300+ let zero = BoxedMontyForm :: zero ( params. clone ( ) ) ;
301+ let one = BoxedMontyForm :: one ( params. clone ( ) ) ;
305302 let two = one. add ( & one) ;
306303
307304 assert_eq ! ( zero. div_by_2( ) , zero) ;
0 commit comments