change IF of Modp::init

pull/2/head
MITSUNARI Shigeo 6 years ago
parent ec765198b9
commit 27a7a0140e
  1. 5
      include/mcl/gmp_util.hpp
  2. 2
      test/fp_test.cpp

@ -877,10 +877,11 @@ struct Modp {
mcl::gmp::setArray(&b, x, mcl::gmp::getUnit(x), unitSize);
assert(b);
}
void init(const mpz_class& p, size_t unitSize)
void init(const mpz_class& p)
{
p_ = p;
N_ = unitSize;
size_t bitSize = mcl::gmp::getBitSize(p);
N_ = (bitSize + unitBitSize - 1) / unitBitSize;
u_ = (mpz_class(1) << (unitBitSize * 2 * N_)) / p_;
a_ = mpz_class(1) << (unitBitSize * (N_ + 1));
}

@ -798,7 +798,7 @@ void modpTest()
(mpz_class(1) << Fp::getOp().N * mcl::fp::UnitBitSize * 2) - 1,
};
mcl::Modp modp;
modp.init(p, Fp::getUnitSize());
modp.init(p);
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) {
const mpz_class& x = tbl[i];
mpz_class r1, r2;

Loading…
Cancel
Save