use Op instead of p

dev
MITSUNARI Shigeo 10 years ago
parent f519ccc1f8
commit 78dc38ce48
  1. 2
      include/mcl/fp.hpp
  2. 5
      include/mcl/fp_base.hpp
  3. 4
      src/fp.cpp

@ -425,7 +425,7 @@ public:
}
static inline void invG(Unit *y, const Unit *x)
{
op_.invG(y, x, op_.p);
op_.invG(y, x, op_);
}
private:
static inline void inFromStr(mpz_class& x, bool *isMinus, const std::string& str, int base)

@ -35,8 +35,11 @@ typedef uint32_t Unit;
typedef uint64_t Unit;
#endif
struct Op;
typedef void (*void1op)(Unit*);
typedef void (*void2op)(Unit*, const Unit*);
typedef void (*void2opOp)(Unit*, const Unit*, const Op&);
typedef void (*void3op)(Unit*, const Unit*, const Unit*);
typedef void (*void4op)(Unit*, const Unit*, const Unit*, const Unit*);
typedef int (*int2op)(Unit*, const Unit*);
@ -159,7 +162,7 @@ struct Op {
void2op fromMont;
// require p
void3op negG;
void3op invG;
void2opOp invG;
void4op addG;
void4op subG;
void3op mulPreG;

@ -122,12 +122,12 @@ struct OpeFunc {
mpz_mod(my, mx, mp);
local::clearArray(y, my->_mp_size, N);
}
static inline void invC(Unit *y, const Unit *x, const Unit *p)
static inline void invC(Unit *y, const Unit *x, const Op& op)
{
mpz_class my;
mpz_t mx, mp;
set_mpz_t(mx, x);
set_mpz_t(mp, p);
set_mpz_t(mp, op.p);
mpz_invert(my.get_mpz_t(), mx, mp);
local::toArray(y, N, my.get_mpz_t());
}

Loading…
Cancel
Save