diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2018-05-23 19:03:55 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2018-05-23 19:03:55 +0800 |
commit | 34573a2444fc42fb417b26cce484146d5a910a0d (patch) | |
tree | e19837abd38a7da1c98093864a06c0ce4ccfb451 /include/mcl/bn.hpp | |
parent | 6b29693b6423791fb1590c2b7e8f307bcb5de09d (diff) | |
download | dexon-mcl-34573a2444fc42fb417b26cce484146d5a910a0d.tar.gz dexon-mcl-34573a2444fc42fb417b26cce484146d5a910a0d.tar.zst dexon-mcl-34573a2444fc42fb417b26cce484146d5a910a0d.zip |
Vector without exception
Diffstat (limited to 'include/mcl/bn.hpp')
-rw-r--r-- | include/mcl/bn.hpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/include/mcl/bn.hpp b/include/mcl/bn.hpp index 04397f6..1070c44 100644 --- a/include/mcl/bn.hpp +++ b/include/mcl/bn.hpp @@ -10,6 +10,7 @@ #include <mcl/ec.hpp> #include <mcl/curve_type.h> #include <assert.h> +#include <vector> /* set bit size of Fp and Fr @@ -105,7 +106,7 @@ void Frobenius3(G2& D, const G2& S); namespace local { -typedef std::vector<int8_t> SignVec; +typedef mcl::Vector<int8_t> SignVec; inline size_t getPrecomputeQcoeffSize(const SignVec& sv) { @@ -1707,6 +1708,13 @@ inline void precomputeG2(std::vector<Fp6>& Qcoeff, const G2& Q) Qcoeff.resize(BN::param.precomputedQcoeffSize); precomputeG2(Qcoeff.data(), Q); } +inline bool precomputeG2(mcl::Vector<Fp6>& Qcoeff, const G2& Q) +{ + bool b = Qcoeff.resize(BN::param.precomputedQcoeffSize); + if (!b) return false; + precomputeG2(Qcoeff.data(), Q); + return true; +} inline void precomputedMillerLoop(Fp12& f, const G1& P_, const Fp6* Qcoeff) { G1 P(P_); @@ -1747,6 +1755,10 @@ inline void precomputedMillerLoop(Fp12& f, const G1& P, const std::vector<Fp6>& { precomputedMillerLoop(f, P, Qcoeff.data()); } +inline void precomputedMillerLoop(Fp12& f, const G1& P, const mcl::Vector<Fp6>& Qcoeff) +{ + precomputedMillerLoop(f, P, Qcoeff.data()); +} /* f = MillerLoop(P1, Q1) x MillerLoop(P2, Q2) */ @@ -1805,6 +1817,10 @@ inline void precomputedMillerLoop2(Fp12& f, const G1& P1, const std::vector<Fp6> { precomputedMillerLoop2(f, P1, Q1coeff.data(), P2, Q2coeff.data()); } +inline void precomputedMillerLoop2(Fp12& f, const G1& P1, const mcl::Vector<Fp6>& Q1coeff, const G1& P2, const mcl::Vector<Fp6>& Q2coeff) +{ + precomputedMillerLoop2(f, P1, Q1coeff.data(), P2, Q2coeff.data()); +} inline void mapToG1(bool *pb, G1& P, const Fp& x) { *pb = BN::param.mapTo.calcG1(P, x); } inline void mapToG2(bool *pb, G2& P, const Fp2& x) { *pb = BN::param.mapTo.calcG2(P, x); } inline void mapToG1(G1& P, const Fp& x) |