Skip to content

Commit 76e6739

Browse files
committed
adds profile counts to alt_bn128 g1,g2 add operations and fixes comments
1 parent 487872b commit 76e6739

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

libff/algebra/curves/alt_bn128/alt_bn128_g1.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ alt_bn128_G1 alt_bn128_G1::operator+(const alt_bn128_G1 &other) const
179179
return this->dbl();
180180
}
181181

182+
#ifdef PROFILE_OP_COUNTS
183+
this->add_cnt++;
184+
#endif
185+
182186
// rest of add case
183187
alt_bn128_Fq H = U2 - U1; // H = U2-U1
184188
alt_bn128_Fq S2_minus_S1 = S2-S1;
@@ -259,10 +263,9 @@ alt_bn128_G1 alt_bn128_G1::mixed_add(const alt_bn128_G1 &other) const
259263
#ifdef PROFILE_OP_COUNTS
260264
this->add_cnt++;
261265
#endif
262-
263266

264267
alt_bn128_Fq H = U2-(this->X); // H = U2-X1
265-
alt_bn128_Fq HH = H.squared() ; // HH = H&2
268+
alt_bn128_Fq HH = H.squared() ; // HH = H^2
266269
alt_bn128_Fq I = HH+HH; // I = 4*HH
267270
I = I + I;
268271
alt_bn128_Fq J = H*I; // J = H*I

libff/algebra/curves/alt_bn128/alt_bn128_g2.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ alt_bn128_G2 alt_bn128_G2::operator+(const alt_bn128_G2 &other) const
189189
return this->dbl();
190190
}
191191

192+
#ifdef PROFILE_OP_COUNTS
193+
this->add_cnt++;
194+
#endif
195+
192196
// rest of add case
193197
alt_bn128_Fq2 H = U2 - U1; // H = U2-U1
194198
alt_bn128_Fq2 S2_minus_S1 = S2-S1;
@@ -271,7 +275,7 @@ alt_bn128_G2 alt_bn128_G2::mixed_add(const alt_bn128_G2 &other) const
271275
#endif
272276

273277
alt_bn128_Fq2 H = U2-(this->X); // H = U2-X1
274-
alt_bn128_Fq2 HH = H.squared() ; // HH = H&2
278+
alt_bn128_Fq2 HH = H.squared() ; // HH = H^2
275279
alt_bn128_Fq2 I = HH+HH; // I = 4*HH
276280
I = I + I;
277281
alt_bn128_Fq2 J = H*I; // J = H*I

0 commit comments

Comments
 (0)