@@ -170,8 +170,9 @@ where
170
170
} else {
171
171
let cs = self . cs ( ) ;
172
172
let infinity = self . is_zero ( ) ?;
173
- let zero_x = F :: zero ( ) ;
174
- let zero_y = F :: one ( ) ;
173
+ let zero_affine = SWAffine :: < P > :: zero ( ) ;
174
+ let zero_x = F :: new_constant ( cs. clone ( ) , & zero_affine. x ) ?;
175
+ let zero_y = F :: new_constant ( cs. clone ( ) , & zero_affine. y ) ?;
175
176
// Allocate a variable whose value is either `self.z.inverse()` if the inverse
176
177
// exists, and is zero otherwise.
177
178
let z_inv = F :: new_witness ( ark_relations:: ns!( cs, "z_inverse" ) , || {
@@ -210,6 +211,8 @@ where
210
211
Ok ( ge) => {
211
212
let ge = ge. into_affine ( ) ;
212
213
if ge. is_zero ( ) {
214
+ // These values are convenient since the point satisfies
215
+ // curve equation.
213
216
(
214
217
Ok ( P :: BaseField :: zero ( ) ) ,
215
218
Ok ( P :: BaseField :: one ( ) ) ,
@@ -334,10 +337,10 @@ where
334
337
for bit in affine_bits. iter ( ) . skip ( 1 ) {
335
338
if bit. is_constant ( ) {
336
339
if * bit == & Boolean :: TRUE {
337
- accumulator = accumulator. add_unchecked ( & multiple_of_power_of_two) ?;
340
+ accumulator = accumulator. add_unchecked ( multiple_of_power_of_two) ?;
338
341
}
339
342
} else {
340
- let temp = accumulator. add_unchecked ( & multiple_of_power_of_two) ?;
343
+ let temp = accumulator. add_unchecked ( multiple_of_power_of_two) ?;
341
344
accumulator = bit. select ( & temp, & accumulator) ?;
342
345
}
343
346
multiple_of_power_of_two. double_in_place ( ) ?;
0 commit comments