diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-11-23 09:59:47 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-11-23 09:59:47 +0800 |
commit | 50c498fa0615b6e47654e4f76f26cda467168100 (patch) | |
tree | d4188ab5bd5f013853f42c13a2c7ba199701d725 /include | |
parent | 3573766cdf54aa0fb49793a52104c52c3cbff7e1 (diff) | |
download | tangerine-mcl-50c498fa0615b6e47654e4f76f26cda467168100.tar.gz tangerine-mcl-50c498fa0615b6e47654e4f76f26cda467168100.tar.zst tangerine-mcl-50c498fa0615b6e47654e4f76f26cda467168100.zip |
consider not isFullBit
Diffstat (limited to 'include')
-rw-r--r-- | include/mcl/fp_tower.hpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/mcl/fp_tower.hpp b/include/mcl/fp_tower.hpp index 8c0253f..7b732fe 100644 --- a/include/mcl/fp_tower.hpp +++ b/include/mcl/fp_tower.hpp @@ -442,9 +442,14 @@ struct Fp2DblT { static void sqrPre(Fp2DblT& y, const Fp2& x) { Fp t1, t2; - Fp::addPre(t1, x.b, x.b); // 2b + if (Fp::isFullBit()) { + Fp::add(t1, x.b, x.b); // 2b + Fp::add(t1, x.a, x.b); // a + b + } else { + Fp::addPre(t1, x.b, x.b); // 2b + Fp::addPre(t1, x.a, x.b); // a + b + } FpDbl::mulPre(y.b, t1, x.a); // 2ab - Fp::addPre(t1, x.a, x.b); // a + b Fp::sub(t2, x.a, x.b); // a - b FpDbl::mulPre(y.a, t1, t2); // (a + b)(a - b) } |