From dbc2dcfda98ffa27b4efe821437336d97dc621c8 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Wed, 20 Apr 2016 11:08:39 +0900 Subject: [PATCH] fix Dbl --- include/mcl/bn.hpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/include/mcl/bn.hpp b/include/mcl/bn.hpp index 9e2d1c2..c304638 100644 --- a/include/mcl/bn.hpp +++ b/include/mcl/bn.hpp @@ -16,7 +16,7 @@ struct bnFpTag; typedef mcl::FpT Fp; typedef mcl::Fp2T Fp2; -typedef mcl::FpDblT FpDbl; +typedef Fp::Dbl FpDbl; typedef mcl::Fp6T Fp6; typedef mcl::Fp12T Fp12; @@ -154,22 +154,19 @@ struct Param { half = Fp(1) / Fp(2); Fp2 xi(cp.xi_a, 1); b_invxi = Fp2(b) / xi; - Fp2::power(gammar[0], xi, (p - 1) / 6); + power(gammar[0], xi, (p - 1) / 6); - for (size_t i = 1; i < gammarN; ++i) { + for (size_t i = 1; i < gammarN; i++) { gammar[i] = gammar[i - 1] * gammar[0]; } - for (size_t i = 0; i < gammarN; ++i) { + for (size_t i = 0; i < gammarN; i++) { gammar2[i] = Fp2(gammar[i].a, -gammar[i].b) * gammar[i]; - } - - for (size_t i = 0; i < gammarN; ++i) { gammar3[i] = gammar[i] * gammar2[i]; } - Fp2::power(W2p, xi, (p - 1) / 3); - Fp2::power(W3p, xi, (p - 1) / 2); + power(W2p, xi, (p - 1) / 3); + power(W3p, xi, (p - 1) / 2); Fp2 tmp; Fp2::power(tmp, xi, (p * p - 1) / 6); assert(tmp.b.isZero());