diff options
| author | MITSUNARI Shigeo <herumi@nifty.com> | 2016-03-15 16:45:33 +0800 |
|---|---|---|
| committer | MITSUNARI Shigeo <herumi@nifty.com> | 2016-03-15 16:45:33 +0800 |
| commit | a5dbd60af6ce1d1c62b1ad034ba89ffd4e264b80 (patch) | |
| tree | cd7ff9b1812883167ca144d9d0594a4e49d94df2 | |
| parent | e73eb03ea7f5c78dbdffc92a21548cda3dcdee3f (diff) | |
| download | tangerine-mcl-a5dbd60af6ce1d1c62b1ad034ba89ffd4e264b80.tar.gz tangerine-mcl-a5dbd60af6ce1d1c62b1ad034ba89ffd4e264b80.tar.zst tangerine-mcl-a5dbd60af6ce1d1c62b1ad034ba89ffd4e264b80.zip | |
Fp::sqr without FpDbl
| -rw-r--r-- | include/mcl/fp_tower.hpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/mcl/fp_tower.hpp b/include/mcl/fp_tower.hpp index 828e9a1..1139c8b 100644 --- a/include/mcl/fp_tower.hpp +++ b/include/mcl/fp_tower.hpp @@ -275,6 +275,15 @@ private: Fp::sub(py[0], aa, bb); // a^2 - b^2 Fp::add(py[1], t, t); // 2ab #else +#if 1 // faster than using FpDbl + Fp t1, t2, t3; + Fp::add(t1, b, b); // 2b + t1 *= a; // 2ab + Fp::add(t2, a, b); // a + b + Fp::sub(t3, a, b); // a - b + Fp::mul(py[0], t2, t3); // (a + b)(a - b) + py[1] = t1; +#else Fp t1, t2; FpDbl d1, d2; Fp::addNC(t1, b, b); // 2b @@ -285,6 +294,7 @@ private: FpDbl::mod(py[0], d1); FpDbl::mod(py[1], d2); #endif +#endif } /* xi = xi_c + i |
