remove warnings

update-fork
MITSUNARI Shigeo 4 years ago
parent 922a935e26
commit f52f4668ac
  1. 4
      include/mcl/gmp_util.hpp
  2. 5
      misc/snark-p.py
  3. 20
      src/fp_generator.hpp
  4. 2
      test/bench.hpp

@ -951,7 +951,7 @@ struct SmallModp {
static const size_t maxTblSize = (MCL_MAX_BIT_SIZE + unitBitSize - 1) / unitBitSize + 1;
static const size_t maxMulN = 9;
static const size_t pMulTblN = maxMulN + 1;
int N_;
uint32_t N_;
uint32_t shiftL_;
uint32_t shiftR_;
uint32_t maxIdx_;
@ -997,7 +997,7 @@ struct SmallModp {
void init(const mpz_class& p)
{
size_t pBitSize = mcl::gmp::getBitSize(p);
N_ = (pBitSize + unitBitSize - 1) / unitBitSize;
N_ = uint32_t((pBitSize + unitBitSize - 1) / unitBitSize);
shiftR_ = (pBitSize - 1) % unitBitSize;
shiftL_ = unitBitSize - shiftR_;
mpz_class t = 0;

@ -11,3 +11,8 @@ print("maxarg")
for i in range(16):
print(i, maxarg(i << 253))
x=0x2c130429c1d4802eb8703197d038ebd5109f96aee333bd027963094f5bb33ad
y = x * 9
print(hex(y))

@ -3656,25 +3656,25 @@ private:
}
{
Pack t = sf.t;
Pack t2 = sf.t;
if (pn_ == 4) {
t = t.sub(0, pn_ * 2);
t2 = t2.sub(0, pn_ * 2);
} else if (pn_ == 6) {
t.append(gp1);
t.append(gp2);
t2.append(gp1);
t2.append(gp2);
}
assert((int)t.size() == pn_ * 2);
assert((int)t2.size() == pn_ * 2);
mov(gp0, ptr [z]);
load_rm(t, gp0 + FpByte_ * 2);
sub_rm(t, gp0); // d1 -= d0
sub_rm(t, (RegExp)d2); // d1 -= d2
store_mr(gp0 + FpByte_ * 2, t);
load_rm(t2, gp0 + FpByte_ * 2);
sub_rm(t2, gp0); // d1 -= d0
sub_rm(t2, (RegExp)d2); // d1 -= d2
store_mr(gp0 + FpByte_ * 2, t2);
gen_raw_sub(gp0, gp0, d2, rax, pn_);
const RegExp& d0H = gp0 + pn_ * 8;
const RegExp& d2H = (RegExp)d2 + pn_ * 8;
gen_raw_fp_sub(d0H, d0H, d2H, t, true);
gen_raw_fp_sub(d0H, d0H, d2H, t2, true);
}
add(rsp, SS);
ret();

@ -85,6 +85,7 @@ void testBench(const G1& P, const G2& Q)
const int C3 = 100000;
#if 1
const int C2 = 3000;
{
mpz_class a = x.getMpz();
CYBOZU_BENCH_C("G1::mulCT ", C, G1::mulCT, Pa, P, a);
CYBOZU_BENCH_C("G1::mul ", C, G1::mul, Pa, Pa, a);
@ -95,6 +96,7 @@ void testBench(const G1& P, const G2& Q)
CYBOZU_BENCH_C("G2::add ", C, G2::add, Qa, Qa, Q);
CYBOZU_BENCH_C("G2::dbl ", C, G2::dbl, Qa, Qa);
CYBOZU_BENCH_C("GT::pow ", C, GT::pow, e1, e1, a);
}
// CYBOZU_BENCH_C("GT::powGLV ", C, BN::param.glv2.pow, e1, e1, a);
G1 PP;
G2 QQ;

Loading…
Cancel
Save