66//!
77//! Copyright (c) 2023 Privacy Scaling Explorations Team
88
9- #![ allow( clippy:: needless_range_loop) ]
9+ #![ allow( clippy:: needless_range_loop, trivial_numeric_casts ) ]
1010
11- use crate :: limb:: { Limb , SignedWord , WideWord , Word } ;
11+ use crate :: limb:: { Limb , SignedWideWord , SignedWord , WideWord , Word } ;
1212use core:: {
1313 cmp:: PartialEq ,
1414 ops:: { Add , Mul , Neg , Sub } ,
@@ -95,7 +95,7 @@ impl<const L: usize> BernsteinYangInverter<L> {
9595 let ( mut steps, mut f, mut g) = (
9696 BITS as SignedWord ,
9797 f. lowest ( ) as SignedWord ,
98- g. lowest ( ) as i128 ,
98+ g. lowest ( ) as SignedWideWord ,
9999 ) ;
100100 let mut t: Matrix = [ [ 1 , 0 ] , [ 0 , 1 ] ] ;
101101
@@ -108,7 +108,7 @@ impl<const L: usize> BernsteinYangInverter<L> {
108108 break ;
109109 }
110110 if delta > 0 {
111- ( delta, f, g) = ( -delta, g as SignedWord , -f as i128 ) ;
111+ ( delta, f, g) = ( -delta, g as SignedWord , -f as SignedWideWord ) ;
112112 ( t[ 0 ] , t[ 1 ] ) = ( t[ 1 ] , [ -t[ 0 ] [ 0 ] , -t[ 0 ] [ 1 ] ] ) ;
113113 }
114114
@@ -119,7 +119,7 @@ impl<const L: usize> BernsteinYangInverter<L> {
119119 let w = ( g as SignedWord ) . wrapping_mul ( f. wrapping_mul ( 3 ) ^ 28 ) & mask;
120120
121121 t[ 1 ] = [ t[ 0 ] [ 0 ] * w + t[ 1 ] [ 0 ] , t[ 0 ] [ 1 ] * w + t[ 1 ] [ 1 ] ] ;
122- g += w as i128 * f as i128 ;
122+ g += w as SignedWideWord * f as SignedWideWord ;
123123 }
124124
125125 ( delta, t)
0 commit comments