File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ criterion = "0.2"
2222[dependencies ]
2323bimap = { version = " 0.4.0" }
2424itertools = { version = " 0.8.0" }
25- num = { version = " 0.2 .0" , features = [" rand" ] }
26- num-traits = { version = " 0.2.8 " }
25+ num = { version = " 0.4 .0" , features = [" rand" ] }
26+ num-traits = { version = " 0.2.14 " }
2727
2828[[bench ]]
2929name = " nth_root"
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ impl<F: Field> GadgetBuilder<F> {
4141 let max_term = ( BigUint :: one ( ) << term. len ( ) ) - BigUint :: one ( ) ;
4242 max_sum += max_term;
4343 }
44- let sum_bits = max_sum. bits ( ) ;
44+ let sum_bits = max_sum. bits ( ) as usize ;
4545
4646 // TODO: Generalize this addition function to support larger operands.
4747 // We can split the bits into chunks and perform addition on joined chunks.
@@ -188,4 +188,4 @@ mod tests {
188188 let mut values_0 = binary_unsigned_values ! ( & x_wire => & BigUint :: zero( ) ) ;
189189 assert ! ( gadget. execute( & mut values_0) ) ;
190190 }
191- }
191+ }
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ impl<F: Field> Element<F> {
138138
139139 /// The number of bits needed to encode this particular field element.
140140 pub fn bits ( & self ) -> usize {
141- self . to_biguint ( ) . bits ( )
141+ self . to_biguint ( ) . bits ( ) as usize
142142 }
143143
144144 /// Return the i'th least significant bit. So, for example, x.bit(0) returns the least
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ impl LCG {
3030 }
3131
3232 pub fn next_biguint ( & mut self , limit_exclusive : BigUint ) -> BigUint {
33- let bits = ( & limit_exclusive - BigUint :: one ( ) ) . bits ( ) ;
33+ let bits = ( & limit_exclusive - BigUint :: one ( ) ) . bits ( ) as usize ;
3434 loop {
3535 let n = self . next_biguint_bits ( bits) ;
3636 if n < limit_exclusive {
@@ -67,4 +67,4 @@ mod tests {
6767 assert_eq ! ( lcg. next_u32( ) , 3519870697 ) ;
6868 assert_eq ! ( lcg. next_u32( ) , 2868466484 ) ;
6969 }
70- }
70+ }
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ impl<F: Field> WireValues<F> {
4747
4848 pub fn set_binary_unsigned ( & mut self , wire : & BinaryWire , value : & BigUint ) {
4949 let l = wire. len ( ) ;
50- assert ! ( value. bits( ) <= l, "Value does not fit" ) ;
50+ assert ! ( value. bits( ) <= l as u64 , "Value does not fit" ) ;
5151
5252 for i in 0 ..l {
5353 let value = ( ( value >> i) & BigUint :: one ( ) ) . is_one ( ) ;
@@ -118,4 +118,4 @@ macro_rules! binary_unsigned_values {
118118 values
119119 }
120120 }
121- }
121+ }
You can’t perform that action at this time.
0 commit comments