diff options
| author | MITSUNARI Shigeo <herumi@nifty.com> | 2017-01-11 11:16:31 +0800 |
|---|---|---|
| committer | MITSUNARI Shigeo <herumi@nifty.com> | 2017-01-11 11:16:36 +0800 |
| commit | bf035e3692e283b687d6ae2bb8e111b5c088b612 (patch) | |
| tree | f10201f34fe46c61920bfc7643bd5144d7330668 /include/mcl/fp_tower.hpp | |
| parent | 7b99668980fd9346e319d828f95b64758b64cfd0 (diff) | |
| download | tangerine-mcl-bf035e3692e283b687d6ae2bb8e111b5c088b612.tar.gz tangerine-mcl-bf035e3692e283b687d6ae2bb8e111b5c088b612.tar.zst tangerine-mcl-bf035e3692e283b687d6ae2bb8e111b5c088b612.zip | |
a little faster fp2_mul for llvm
Diffstat (limited to 'include/mcl/fp_tower.hpp')
| -rw-r--r-- | include/mcl/fp_tower.hpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/mcl/fp_tower.hpp b/include/mcl/fp_tower.hpp index a0edde5..28f1772 100644 --- a/include/mcl/fp_tower.hpp +++ b/include/mcl/fp_tower.hpp @@ -214,7 +214,11 @@ public: if (op.isFastMod) { op.fp2_mul = fp2_mulW; } else if (!op.isFullBit) { - op.fp2_mul = fp2_mulUseDblUseNCW; + if (sizeof(Fp) * 8 == op.N * fp::UnitBitSize && op.fp2_mulNF) { + op.fp2_mul = fp2_mulNFW; + } else { + op.fp2_mul = fp2_mulUseDblUseNCW; + } } else { op.fp2_mul = fp2_mulUseDblW; } @@ -306,6 +310,11 @@ private: FpDbl::sub(d1, d1, d2); // ac - bd FpDbl::mod(pz[0], d1); // set z0 } + static void fp2_mulNFW(Unit *z, const Unit *x, const Unit *y) + { + const fp::Op& op = Fp::op_; + op.fp2_mulNF(z, x, y, op.p); + } static void fp2_mulUseDblUseNCW(Unit *z, const Unit *x, const Unit *y) { const Fp *px = reinterpret_cast<const Fp*>(x); |
