From c47fdddc1725bbcfdfcbf110f90a3bf41feffc83 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sun, 26 Aug 2018 16:06:16 +0900 Subject: [PATCH] cast of function does not run on mcl-wasm --- include/mcl/fp_tower.hpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/mcl/fp_tower.hpp b/include/mcl/fp_tower.hpp index 1a34d1c..efe8b26 100644 --- a/include/mcl/fp_tower.hpp +++ b/include/mcl/fp_tower.hpp @@ -129,6 +129,10 @@ public: static void sub(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_sub(z.v_, x.v_, y.v_, Fp::op_.p); } static void mod(Fp& z, const FpDblT& xy) { Fp::op_.fpDbl_mod(z.v_, xy.v_, Fp::op_.p); } #endif + static void addPreC(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_addPre(z.v_, x.v_, y.v_); } + static void subPreC(FpDblT& z, const FpDblT& x, const FpDblT& y) { Fp::op_.fpDbl_subPre(z.v_, x.v_, y.v_); } + static void mulPreC(FpDblT& xy, const Fp& x, const Fp& y) { Fp::op_.fpDbl_mulPre(xy.v_, x.v_, y.v_); } + static void sqrPreC(FpDblT& xx, const Fp& x) { Fp::op_.fpDbl_sqrPre(xx.v_, x.v_); } static void (*addPre)(FpDblT& z, const FpDblT& x, const FpDblT& y); static void (*subPre)(FpDblT& z, const FpDblT& x, const FpDblT& y); /* @@ -155,22 +159,22 @@ public: if (op.fpDbl_addPreA_) { addPre = (void (*)(FpDblT&, const FpDblT&, const FpDblT&))op.fpDbl_addPreA_; } else { - addPre = (void (*)(FpDblT&, const FpDblT&, const FpDblT&))op.fpDbl_addPre; + addPre = addPreC; } if (op.fpDbl_subPreA_) { subPre = (void (*)(FpDblT&, const FpDblT&, const FpDblT&))op.fpDbl_subPreA_; } else { - subPre = (void (*)(FpDblT&, const FpDblT&, const FpDblT&))op.fpDbl_subPre; + subPre = subPreC; } if (op.fpDbl_mulPreA_) { mulPre = (void (*)(FpDblT&, const Fp&, const Fp&))op.fpDbl_mulPreA_; } else { - mulPre = (void (*)(FpDblT&, const Fp&, const Fp&))op.fpDbl_mulPre; + mulPre = mulPreC; } if (op.fpDbl_sqrPreA_) { sqrPre = (void (*)(FpDblT&, const Fp&))op.fpDbl_sqrPreA_; } else { - sqrPre = (void (*)(FpDblT&, const Fp&))op.fpDbl_sqrPre; + sqrPre = sqrPreC; } } void operator+=(const FpDblT& x) { add(*this, *this, x); }