remove testHashAndMapto in bn_test.cpp

dev
MITSUNARI Shigeo 7 years ago
parent d8806e2df3
commit 6d6487b748
  1. 6
      include/mcl/fp.hpp
  2. 3
      misc/mul.cpp
  3. 15
      src/fp.cpp
  4. 1
      test/bn_test.cpp

@ -118,6 +118,12 @@ public:
{
gmp::getStr(pstr, op_.mp);
}
static std::string getModulo()
{
std::string s;
getModulo(s);
return s;
}
static inline bool isFullBit() { return op_.isFullBit; }
/*
binary patter of p

@ -26,10 +26,11 @@ CYBOZU_TEST_AUTO(mulPre)
const char *pTbl[] = {
"0x2523648240000001ba344d80000000086121000000000013a700000000000013",
"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff",
"6701817056313037086248947066310538444882082605308124576230408038843357549886356779857393369967010764802541005796711440355753503701056323603", // 462 bit
"4562440617622195218641171605700291324893228507248559930579192517899275167208677386505912811317371399778642309573594407310688704721375437998252661319722214188251994674360264950082874192246603471", // 640 bit
"1552518092300708935148979488462502555256886017116696611139052038026050952686376886330878408828646477950487730697131073206171580044114814391444287275041181139204454976020849905550265285631598444825262999193716468750892846853816057031", // 768 bit
};
const size_t N = 12;
const size_t N = 16;
const Mode modeTbl[] = {
FP_GMP_MONT,
#ifdef MCL_USE_LLVM

@ -277,7 +277,7 @@ struct SetFpDbl<N, true> {
}
};
template<size_t N, class Tag, bool enableFpDbl>
template<size_t N, class Tag, bool enableFpDbl, bool gmpIsFasterThanLLVM>
void setOp2(Op& op)
{
op.fp_shr1 = Shr1<N, Tag>::f;
@ -304,8 +304,10 @@ void setOp2(Op& op)
op.fpDbl_mod = Dbl_Mod<N, Tag>::f;
}
op.fp_mulUnit = MulUnit<N, Tag>::f;
op.fpDbl_mulPre = MulPre<N, Tag>::f;
op.fpDbl_sqrPre = SqrPre<N, Tag>::f;
if (!gmpIsFasterThanLLVM) {
op.fpDbl_mulPre = MulPre<N, Tag>::f;
op.fpDbl_sqrPre = SqrPre<N, Tag>::f;
}
op.fp_mulUnitPre = MulUnitPre<N, Tag>::f;
op.fpN1_mod = N1_Mod<N, Tag>::f;
op.fpDbl_add = DblAdd<N, Tag>::f;
@ -328,17 +330,18 @@ void setOp(Op& op, Mode mode)
} else {
op.fp_invOp = fp_invOpC;
}
setOp2<N, Gtag, true>(op);
setOp2<N, Gtag, true, false>(op);
#ifdef MCL_USE_LLVM
if (mode != fp::FP_GMP && mode != fp::FP_GMP_MONT) {
#if defined(MCL_USE_XBYAK) && CYBOZU_HOST == CYBOZU_HOST_INTEL
const bool gmpIsFasterThanLLVM = false;//(N == 8 && MCL_SIZEOF_UNIT == 8);
Xbyak::util::Cpu cpu;
if (cpu.has(Xbyak::util::Cpu::tBMI2)) {
setOp2<N, LBMI2tag, (N * UnitBitSize <= 256)>(op);
setOp2<N, LBMI2tag, (N * UnitBitSize <= 256), gmpIsFasterThanLLVM>(op);
} else
#endif
{
setOp2<N, Ltag, (N * UnitBitSize <= 256)>(op);
setOp2<N, Ltag, (N * UnitBitSize <= 256), false>(op);
}
}
#else

@ -371,7 +371,6 @@ CYBOZU_TEST_AUTO(naive)
testPairing(P, Q, ts.e);
testPrecomputed(P, Q);
testMillerLoop2(P, Q);
testHashAndMapto();
}
int count = (int)clk.getCount();
if (count) {

Loading…
Cancel
Save