diff --git a/include/mcl/fp_tower.hpp b/include/mcl/fp_tower.hpp index 3bb7b97..7fa885b 100644 --- a/include/mcl/fp_tower.hpp +++ b/include/mcl/fp_tower.hpp @@ -263,11 +263,14 @@ public: sqrA(y.a.v_, x.a.v_); #endif } + static void mul2(Fp2T& y, const Fp2T& x) + { #ifdef MCL_XBYAK_DIRECT_CALL - static void (*mul2)(Fp2T& y, const Fp2T& x); + Fp::op_.fp2_mul2A_(y.a.v_, x.a.v_); #else - static void mul2(Fp2T& y, const Fp2T& x) { mul2C(y, x); } + mul2A(y.a.v_, x.a.v_); #endif + } static void (*mul_xi)(Fp2T& y, const Fp2T& x); static void addPre(Fp2T& z, const Fp2T& x, const Fp2T& y) { Fp::addPre(z.a, x.a, y.a); Fp::addPre(z.b, x.b, y.b); } static void inv(Fp2T& y, const Fp2T& x) { Fp::op_.fp2_inv(y.a.v_, x.a.v_); } @@ -430,8 +433,9 @@ public: if (op.fp2_sqrA_ == 0) { op.fp2_sqrA_ = sqrA; } - mul2 = fp::func_ptr_cast(op.fp2_mul2A_); - if (mul2 == 0) mul2 = mul2C; + if (op.fp2_mul2A_ == 0) { + op.fp2_mul2A_ = mul2A; + } mul_xi = fp::func_ptr_cast(op.fp2_mul_xiA_); #endif op.fp2_inv = fp2_invW; @@ -554,8 +558,10 @@ private: FpDbl::mod(z.a, d.a); FpDbl::mod(z.b, d.b); } - static void mul2C(Fp2T& y, const Fp2T& x) + static void mul2A(Unit *py, const Unit *px) { + Fp2T& y = *reinterpret_cast(py); + const Fp2T& x = *reinterpret_cast(px); Fp::mul2(y.a, x.a); Fp::mul2(y.b, x.b); } @@ -640,9 +646,6 @@ private: } }; -#ifdef MCL_XBYAK_DIRECT_CALL -template void (*Fp2T::mul2)(Fp2T& y, const Fp2T& x); -#endif template void (*Fp2T::mul_xi)(Fp2T& y, const Fp2T& x); template