|
|
|
@ -154,7 +154,6 @@ struct Compress { |
|
|
|
|
assert(&nume != &denomi); |
|
|
|
|
|
|
|
|
|
if (g2_.isZero()) { |
|
|
|
|
// Fp2::add(nume, g4_, g4_);
|
|
|
|
|
Fp2::mul2(nume, g4_); |
|
|
|
|
nume *= g5_; |
|
|
|
|
denomi = g3_; |
|
|
|
@ -164,7 +163,6 @@ struct Compress { |
|
|
|
|
Fp2::mul_xi(denomi, nume); |
|
|
|
|
Fp2::sqr(nume, g4_); |
|
|
|
|
Fp2::sub(t, nume, g3_); |
|
|
|
|
// t += t;
|
|
|
|
|
Fp2::mul2(t, t); |
|
|
|
|
t += nume; |
|
|
|
|
Fp2::add(nume, denomi, t); |
|
|
|
@ -182,7 +180,6 @@ struct Compress { |
|
|
|
|
Fp2::sqr(t0, g1_); |
|
|
|
|
Fp2::mul(t1, g3_, g4_); |
|
|
|
|
t0 -= t1; |
|
|
|
|
// t0 += t0;
|
|
|
|
|
Fp2::mul2(t0, t0); |
|
|
|
|
t0 -= t1; |
|
|
|
|
Fp2::mul(t1, g2_, g5_); |
|
|
|
@ -222,11 +219,9 @@ public: |
|
|
|
|
Fp2Dbl::sqrPre(T2, z.g2_); |
|
|
|
|
Fp2::mul_xi(t1, t0); |
|
|
|
|
z.g2_ += t1; |
|
|
|
|
// z.g2_ += z.g2_;
|
|
|
|
|
Fp2::mul2(z.g2_, z.g2_); |
|
|
|
|
z.g2_ += t1; |
|
|
|
|
Fp2::sub(t1, t2, z.g3_); |
|
|
|
|
// t1 += t1;
|
|
|
|
|
Fp2::mul2(t1, t1); |
|
|
|
|
Fp2Dbl::sqrPre(T1, z.g3_); |
|
|
|
|
Fp2::add(z.g3_, t1, t2); |
|
|
|
@ -234,14 +229,12 @@ public: |
|
|
|
|
T0 += T2; |
|
|
|
|
Fp2Dbl::mod(t0, T0); |
|
|
|
|
Fp2::sub(z.g4_, t0, z.g4_); |
|
|
|
|
// z.g4_ += z.g4_;
|
|
|
|
|
Fp2::mul2(z.g4_, z.g4_); |
|
|
|
|
z.g4_ += t0; |
|
|
|
|
Fp2Dbl::addPre(T2, T2, T1); |
|
|
|
|
T3 -= T2; |
|
|
|
|
Fp2Dbl::mod(t0, T3); |
|
|
|
|
z.g5_ += t0; |
|
|
|
|
// z.g5_ += z.g5_;
|
|
|
|
|
Fp2::mul2(z.g5_, z.g5_); |
|
|
|
|
z.g5_ += t0; |
|
|
|
|
} |
|
|
|
@ -1084,31 +1077,25 @@ inline void fasterSqr(Fp12& y, const Fp12& x) |
|
|
|
|
Fp2 t0, t1; |
|
|
|
|
sqrFp4(t0, t1, x0, x1); |
|
|
|
|
Fp2::sub(y0, t0, x0); |
|
|
|
|
// y0 += y0;
|
|
|
|
|
Fp2::mul2(y0, y0); |
|
|
|
|
y0 += t0; |
|
|
|
|
Fp2::add(y1, t1, x1); |
|
|
|
|
// y1 += y1;
|
|
|
|
|
Fp2::mul2(y1, y1); |
|
|
|
|
y1 += t1; |
|
|
|
|
Fp2 t2, t3; |
|
|
|
|
sqrFp4(t0, t1, x2, x3); |
|
|
|
|
sqrFp4(t2, t3, x4, x5); |
|
|
|
|
Fp2::sub(y4, t0, x4); |
|
|
|
|
// y4 += y4;
|
|
|
|
|
Fp2::mul2(y4, y4); |
|
|
|
|
y4 += t0; |
|
|
|
|
Fp2::add(y5, t1, x5); |
|
|
|
|
// y5 += y5;
|
|
|
|
|
Fp2::mul2(y5, y5); |
|
|
|
|
y5 += t1; |
|
|
|
|
Fp2::mul_xi(t0, t3); |
|
|
|
|
Fp2::add(y2, t0, x2); |
|
|
|
|
// y2 += y2;
|
|
|
|
|
Fp2::mul2(y2, y2); |
|
|
|
|
y2 += t0; |
|
|
|
|
Fp2::sub(y3, t2, x3); |
|
|
|
|
// y3 += y3;
|
|
|
|
|
Fp2::mul2(y3, y3); |
|
|
|
|
y3 += t2; |
|
|
|
|
#endif |
|
|
|
@ -1187,14 +1174,12 @@ inline void dblLineWithoutP(Fp6& l, G2& Q) |
|
|
|
|
Fp2::sqr(t0, Q.z); |
|
|
|
|
Fp2::mul(t4, Q.x, Q.y); |
|
|
|
|
Fp2::sqr(t1, Q.y); |
|
|
|
|
// Fp2::add(t3, t0, t0);
|
|
|
|
|
Fp2::mul2(t3, t0); |
|
|
|
|
Fp2::divBy2(t4, t4); |
|
|
|
|
Fp2::add(t5, t0, t1); |
|
|
|
|
t0 += t3; |
|
|
|
|
mul_twist_b(t2, t0); |
|
|
|
|
Fp2::sqr(t0, Q.x); |
|
|
|
|
// Fp2::add(t3, t2, t2);
|
|
|
|
|
Fp2::mul2(t3, t2); |
|
|
|
|
t3 += t2; |
|
|
|
|
Fp2::sub(Q.x, t1, t3); |
|
|
|
@ -1613,7 +1598,6 @@ inline void expHardPartBN(Fp12& y, const Fp12& x) |
|
|
|
|
inline void makeAdjP(G1& adjP, const G1& P) |
|
|
|
|
{ |
|
|
|
|
Fp x2; |
|
|
|
|
// Fp::add(x2, P.x, P.x);
|
|
|
|
|
Fp::mul2(x2, P.x); |
|
|
|
|
Fp::add(adjP.x, x2, P.x); |
|
|
|
|
Fp::neg(adjP.y, P.y); |
|
|
|
|