aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-10-20 07:41:10 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-10-20 07:41:10 +0800
commit8c74a0b0f0983250aaf23f42390a0cea8d433394 (patch)
tree5e2c951104989b51a3473951fed214cfcb988c66
parentf087f4997e06e871e74bdb71ab29194f56a3a5b3 (diff)
downloadtangerine-mcl-8c74a0b0f0983250aaf23f42390a0cea8d433394.tar.gz
tangerine-mcl-8c74a0b0f0983250aaf23f42390a0cea8d433394.tar.zst
tangerine-mcl-8c74a0b0f0983250aaf23f42390a0cea8d433394.zip
rename mul_Unit to mulUnit
-rw-r--r--include/mcl/fp.hpp6
-rw-r--r--include/mcl/op.hpp8
-rw-r--r--sample/rawbench.cpp8
-rw-r--r--src/fp.cpp8
-rw-r--r--src/fp_generator.hpp20
-rw-r--r--src/fp_proto.hpp4
-rw-r--r--src/gen.cpp20
-rw-r--r--test/fp_generator_test.cpp6
-rw-r--r--test/fp_test.cpp6
9 files changed, 43 insertions, 43 deletions
diff --git a/include/mcl/fp.hpp b/include/mcl/fp.hpp
index 46db4fc..7f93a05 100644
--- a/include/mcl/fp.hpp
+++ b/include/mcl/fp.hpp
@@ -335,7 +335,7 @@ public:
static inline void addPre(FpT& z, const FpT& x, const FpT& y) { op_.fp_addPre(z.v_, x.v_, y.v_); }
static inline void subPre(FpT& z, const FpT& x, const FpT& y) { op_.fp_subPre(z.v_, x.v_, y.v_); }
static inline void mul(FpT& z, const FpT& x, const FpT& y) { op_.fp_mul(z.v_, x.v_, y.v_, op_.p); }
- static inline void mul_Unit(FpT& z, const FpT& x, const Unit y) { op_.fp_mul_Unit(z.v_, x.v_, y, op_.p); }
+ static inline void mulUnit(FpT& z, const FpT& x, const Unit y) { op_.fp_mulUnit(z.v_, x.v_, y, op_.p); }
static inline void inv(FpT& y, const FpT& x) { op_.fp_invOp(y.v_, x.v_, op_); }
static inline void neg(FpT& y, const FpT& x) { op_.fp_neg(y.v_, x.v_, op_.p); }
static inline void sqr(FpT& y, const FpT& x) { op_.fp_sqr(y.v_, x.v_, op_.p); }
@@ -444,10 +444,10 @@ public:
static inline size_t getModBitLen() { return getBitSize(); }
#if 0
private:
- static inline void fp_mul_UnitW(Unit *z, const Unit *x, Unit y, const Unit *p)
+ static inline void fp_mulUnitW(Unit *z, const Unit *x, Unit y, const Unit *p)
{
Unit xy[maxSize + 1];
- op_.fp_mul_UnitPre(xy, x, y);
+ op_.fp_mulUnitPre(xy, x, y);
// z[N] <- xy[N + 1] % p[N]
op_.fpN1_mod(z, xy, p);
}
diff --git a/include/mcl/op.hpp b/include/mcl/op.hpp
index bc11c50..a296801 100644
--- a/include/mcl/op.hpp
+++ b/include/mcl/op.hpp
@@ -97,12 +97,12 @@ struct Op {
void4u fp_mul;
void3u fp_sqr;
void2uOp fp_invOp;
- void2uIu fp_mul_Unit; // fpN1_mod + fp_mul_UnitPre
+ void2uIu fp_mulUnit; // fpN1_mod + fp_mulUnitPre
void3u fpDbl_mulPre;
void2u fpDbl_sqrPre;
int2u fp_preInv;
- void2uI fp_mul_UnitPre; // z[N + 1] = x[N] * y
+ void2uI fp_mulUnitPre; // z[N + 1] = x[N] * y
void3u fpN1_mod; // y[N] = x[N + 1] % p[N]
void4u fpDbl_add;
@@ -164,12 +164,12 @@ struct Op {
fp_mul = 0;
fp_sqr = 0;
fp_invOp = 0;
- fp_mul_Unit = 0;
+ fp_mulUnit = 0;
fpDbl_mulPre = 0;
fpDbl_sqrPre = 0;
fp_preInv = 0;
- fp_mul_UnitPre = 0;
+ fp_mulUnitPre = 0;
fpN1_mod = 0;
fpDbl_add = 0;
diff --git a/sample/rawbench.cpp b/sample/rawbench.cpp
index eab0e7c..81f261a 100644
--- a/sample/rawbench.cpp
+++ b/sample/rawbench.cpp
@@ -32,7 +32,7 @@ void benchRaw(const char *p, mcl::fp::Mode mode)
double fp_addT, fp_subT;
double fp_addPreT, fp_subPreT;
double fp_sqrT, fp_mulT;
- double fp_mul_UnitT, fp_mul_UnitPreT;
+ double fp_mulUnitT, fp_mulUnitPreT;
double fpDbl_addT, fpDbl_subT;
double fpDbl_sqrPreT, fpDbl_mulPreT, fpDbl_modT;
double fp2_sqrT, fp2_mulT;
@@ -47,8 +47,8 @@ void benchRaw(const char *p, mcl::fp::Mode mode)
}
CYBOZU_BENCH_T(fp_sqrT, op.fp_sqr, uz, ux, op.p);
CYBOZU_BENCH_T(fp_mulT, op.fp_mul, uz, ux, uy, op.p);
- CYBOZU_BENCH_T(fp_mul_UnitT, op.fp_mul_Unit, uz, ux, 12345678, op.p);
- CYBOZU_BENCH_T(fp_mul_UnitPreT, op.fp_mul_UnitPre, ux, ux, 12345678);
+ CYBOZU_BENCH_T(fp_mulUnitT, op.fp_mulUnit, uz, ux, 12345678, op.p);
+ CYBOZU_BENCH_T(fp_mulUnitPreT, op.fp_mulUnitPre, ux, ux, 12345678);
CYBOZU_BENCH_T(fpDbl_addT, op.fpDbl_add, uz, ux, uy, op.p);
CYBOZU_BENCH_T(fpDbl_subT, op.fpDbl_sub, uz, uy, ux, op.p);
CYBOZU_BENCH_T(fpDbl_sqrPreT, op.fpDbl_sqrPre, uz, ux);
@@ -78,7 +78,7 @@ void benchRaw(const char *p, mcl::fp::Mode mode)
fp_addT, fp_subT,
fp_addPreT, fp_subPreT,
fp_sqrT, fp_mulT,
- fp_mul_UnitT, fp_mul_UnitPreT,
+ fp_mulUnitT, fp_mulUnitPreT,
fpDbl_addT, fpDbl_subT,
fpDbl_sqrPreT, fpDbl_mulPreT, fpDbl_modT,
fp2_sqrT, fp2_mulT,
diff --git a/src/fp.cpp b/src/fp.cpp
index 4891049..78c18c8 100644
--- a/src/fp.cpp
+++ b/src/fp.cpp
@@ -113,7 +113,7 @@ template<>const u3u AddPre<n, Ltag>::f = &mcl_fp_addPre ## n ## L; \
template<>const u3u SubPre<n, Ltag>::f = &mcl_fp_subPre ## n ## L; \
template<>const void3u MulPre<n, Ltag>::f = &mcl_fpDbl_mulPre ## n ## L; \
template<>const void2u SqrPre<n, Ltag>::f = &mcl_fpDbl_sqrPre ## n ## L; \
-template<>const void2uI Mul_UnitPre<n, Ltag>::f = &mcl_fp_mul_UnitPre ## n ## L; \
+template<>const void2uI Mul_UnitPre<n, Ltag>::f = &mcl_fp_mulUnitPre ## n ## L; \
template<>const void4u Add<n, Ltag>::f = &mcl_fp_add ## n ## L; \
template<>const void4u Sub<n, Ltag>::f = &mcl_fp_sub ## n ## L; \
template<>const void4u Mont<n, Ltag>::f = &mcl_fp_mont ## n ## L; \
@@ -211,10 +211,10 @@ void setOpSub(Op& op)
op.fp_sqr = Sqr<N, Tag>::f;
op.fpDbl_mod = Dbl_Mod<N, Tag>::f;
}
- op.fp_mul_Unit = Mul_Unit<N, Tag>::f;
+ op.fp_mulUnit = Mul_Unit<N, Tag>::f;
op.fpDbl_mulPre = MulPre<N, Tag>::f;
op.fpDbl_sqrPre = SqrPre<N, Tag>::f;
- op.fp_mul_UnitPre = Mul_UnitPre<N, Tag>::f;
+ op.fp_mulUnitPre = Mul_UnitPre<N, Tag>::f;
op.fpN1_mod = N1_Mod<N, Tag>::f;
op.fpDbl_add = DblAdd<N, Tag>::f;
op.fpDbl_sub = DblSub<N, Tag>::f;
@@ -387,7 +387,7 @@ void Op::init(const std::string& mstr, size_t maxBitSize, Mode mode)
}
#ifdef MCL_USE_LLVM
if (primeMode == PM_NICT_P192) {
- fp_mul = &mcl_fp_mul_NIST_P192L;
+ fp_mul = &mcl_fp_mulNIST_P192L;
fp_sqr = &mcl_fp_sqr_NIST_P192L;
fpDbl_mod = &mcl_fpDbl_mod_NIST_P192L;
}
diff --git a/src/fp_generator.hpp b/src/fp_generator.hpp
index 489fe40..a2d70ed 100644
--- a/src/fp_generator.hpp
+++ b/src/fp_generator.hpp
@@ -161,7 +161,7 @@ struct FpGenerator : Xbyak::CodeGenerator {
// preInv
typedef int (*int2op)(uint64_t*, const uint64_t*);
void4u mul_;
- uint3opI mul_Unit_;
+ uint3opI mulUnit_;
void *montRedRaw_;
void2op shr1_;
FpGenerator()
@@ -172,7 +172,7 @@ struct FpGenerator : Xbyak::CodeGenerator {
, pn_(0)
, isFullBit_(0)
, mul_(0)
- , mul_Unit_(0)
+ , mulUnit_(0)
, montRedRaw_(0)
, shr1_(0)
{
@@ -219,8 +219,8 @@ struct FpGenerator : Xbyak::CodeGenerator {
gen_neg();
align(16);
- mul_Unit_ = getCurr<uint3opI>();
- gen_mul_Unit();
+ mulUnit_ = getCurr<uint3opI>();
+ gen_mulUnit();
if (op.primeMode == PM_NICT_P521) {
align(16);
op.fpDbl_mod = getCurr<void3u>();
@@ -345,7 +345,7 @@ struct FpGenerator : Xbyak::CodeGenerator {
wk[0] if useMulx_
wk[0..n-2] otherwise
*/
- void gen_raw_mul_Unit(const RegExp& pz, const RegExp& px, const Reg64& y, const MixPack& wk, const Reg64& t, size_t n)
+ void gen_raw_mulUnit(const RegExp& pz, const RegExp& px, const Reg64& y, const MixPack& wk, const Reg64& t, size_t n)
{
if (n == 1) {
mov(rax, ptr [px]);
@@ -412,7 +412,7 @@ struct FpGenerator : Xbyak::CodeGenerator {
mov(ptr [pz + (n - 1) * 8], rax);
adc(rdx, 0);
}
- void gen_mul_Unit()
+ void gen_mulUnit()
{
// assert(pn_ >= 2);
const int regNum = useMulx_ ? 2 : (1 + std::min(pn_ - 1, 8));
@@ -424,7 +424,7 @@ struct FpGenerator : Xbyak::CodeGenerator {
size_t rspPos = 0;
Pack remain = sf.t.sub(1);
MixPack wk(remain, rspPos, pn_ - 1);
- gen_raw_mul_Unit(pz, px, y, wk, sf.t[0], pn_);
+ gen_raw_mulUnit(pz, px, y, wk, sf.t[0], pn_);
mov(rax, rdx);
}
/*
@@ -2477,10 +2477,10 @@ private:
{
// pc[] += x[] * y
if (isFirst) {
- gen_raw_mul_Unit(pc, px, y, pw1, t, n);
+ gen_raw_mulUnit(pc, px, y, pw1, t, n);
mov(ptr [pc + n * 8], rdx);
} else {
- gen_raw_mul_Unit(pw2, px, y, pw1, t, n);
+ gen_raw_mulUnit(pw2, px, y, pw1, t, n);
mov(t, ptr [pw2 + 0 * 8]);
add(ptr [pc + 0 * 8], t);
for (int i = 1; i < n; i++) {
@@ -2497,7 +2497,7 @@ private:
mov(rax, pp);
mul(qword [pc]);
mov(y, rax); // y = q
- gen_raw_mul_Unit(pw2, p, y, pw1, t, n);
+ gen_raw_mulUnit(pw2, p, y, pw1, t, n);
// c[] = (c[] + pw2[]) >> 64
mov(t, ptr [pw2 + 0 * 8]);
add(t, ptr [pc + 0 * 8]);
diff --git a/src/fp_proto.hpp b/src/fp_proto.hpp
index 799fe6f..fc2abef 100644
--- a/src/fp_proto.hpp
+++ b/src/fp_proto.hpp
@@ -367,7 +367,7 @@ void mcl_fp_add ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl:
void mcl_fp_sub ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y, const mcl::fp::Unit* p); \
mcl::fp::Unit mcl_fp_addPre ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y); \
mcl::fp::Unit mcl_fp_subPre ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y); \
-void mcl_fp_mul_UnitPre ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, mcl::fp::Unit y); \
+void mcl_fp_mulUnitPre ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, mcl::fp::Unit y); \
void mcl_fpDbl_mulPre ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y); \
void mcl_fpDbl_sqrPre ## n ## suf(mcl::fp::Unit* y, const mcl::fp::Unit* x); \
void mcl_fp_mont ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y, const mcl::fp::Unit* p); \
@@ -381,7 +381,7 @@ void mcl_fpDbl_sub ## n ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const m
#define MCL_FP_DEF_FUNC_SPECIAL(suf) \
void mcl_fpDbl_mod_NIST_P192 ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* xy, const mcl::fp::Unit* /* dummy */); \
-void mcl_fp_mul_NIST_P192 ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y, const mcl::fp::Unit* /* dummy */); \
+void mcl_fp_mulNIST_P192 ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* x, const mcl::fp::Unit* y, const mcl::fp::Unit* /* dummy */); \
void mcl_fp_sqr_NIST_P192 ## suf(mcl::fp::Unit* y, const mcl::fp::Unit* x, const mcl::fp::Unit* /* dummy */); \
void mcl_fpDbl_mod_NIST_P521 ## suf(mcl::fp::Unit* z, const mcl::fp::Unit* xy, const mcl::fp::Unit* /* dummy */);
diff --git a/src/gen.cpp b/src/gen.cpp
index 8014dac..f9595c7 100644
--- a/src/gen.cpp
+++ b/src/gen.cpp
@@ -28,7 +28,7 @@ struct Code : public mcl::Generator {
FunctionMap mcl_fp_addM;
FunctionMap mcl_fp_subM;
FunctionMap mulPvM;
- FunctionMap mcl_fp_mul_UnitPreM;
+ FunctionMap mcl_fp_mulUnitPreM;
FunctionMap mcl_fpDbl_mulPreM;
FunctionMap mcl_fpDbl_sqrPreM;
FunctionMap mcl_fp_montM;
@@ -258,13 +258,13 @@ struct Code : public mcl::Generator {
ret(Void);
endFunc();
}
- void gen_mcl_fp_mul_NIST_P192()
+ void gen_mcl_fp_mulNIST_P192()
{
resetGlobalIdx();
Operand pz(IntPtr, 192);
Operand px(IntPtr, unit);
Operand py(IntPtr, unit);
- Function f("mcl_fp_mul_NIST_P192L", Void, pz, px, py);
+ Function f("mcl_fp_mulNIST_P192L", Void, pz, px, py);
verifyAndSetPrivate(f);
beginFunc(f);
Operand buf = _alloca(192, 2);
@@ -284,7 +284,7 @@ struct Code : public mcl::Generator {
gen_makeNIST_P192();
gen_mcl_fpDbl_mod_NIST_P192();
gen_mcl_fp_sqr_NIST_P192();
- gen_mcl_fp_mul_NIST_P192();
+ gen_mcl_fp_mulNIST_P192();
gen_mcl_fpDbl_mod_NIST_P521();
}
Operand extract(const Operand& x, uint32_t shift)
@@ -542,17 +542,17 @@ struct Code : public mcl::Generator {
ret(z);
endFunc();
}
- void gen_mcl_fp_mul_UnitPre()
+ void gen_mcl_fp_mulUnitPre()
{
const int bu = bit + unit;
resetGlobalIdx();
Operand pz(IntPtr, bu);
Operand px(IntPtr, unit);
Operand y(Int, unit);
- std::string name = "mcl_fp_mul_UnitPre" + cybozu::itoa(N) + "L";
- mcl_fp_mul_UnitPreM[N] = Function(name, Void, pz, px, y);
- verifyAndSetPrivate(mcl_fp_mul_UnitPreM[N]);
- beginFunc(mcl_fp_mul_UnitPreM[N]);
+ std::string name = "mcl_fp_mulUnitPre" + cybozu::itoa(N) + "L";
+ mcl_fp_mulUnitPreM[N] = Function(name, Void, pz, px, y);
+ verifyAndSetPrivate(mcl_fp_mulUnitPreM[N]);
+ beginFunc(mcl_fp_mulUnitPreM[N]);
Operand z = call(mulPvM[bit], px, y);
store(z, pz);
ret(Void);
@@ -775,7 +775,7 @@ struct Code : public mcl::Generator {
void gen_mul()
{
gen_mulPv();
- gen_mcl_fp_mul_UnitPre();
+ gen_mcl_fp_mulUnitPre();
gen_mcl_fpDbl_mulPre();
gen_mcl_fpDbl_sqrPre();
gen_mcl_fp_mont();
diff --git a/test/fp_generator_test.cpp b/test/fp_generator_test.cpp
index ad8e7b4..605867d 100644
--- a/test/fp_generator_test.cpp
+++ b/test/fp_generator_test.cpp
@@ -141,7 +141,7 @@ void testNeg(const mcl::fp::Op& op)
void testMulI(const mcl::fp::FpGenerator& fg, int pn)
{
cybozu::XorShift rg;
-//printf("pn=%d, %p\n", pn, fg.mul_Unit_);
+//printf("pn=%d, %p\n", pn, fg.mulUnit_);
for (int i = 0; i < 100; i++) {
uint64_t x[MAX_N];
uint64_t z[MAX_N + 1];
@@ -152,7 +152,7 @@ void testMulI(const mcl::fp::FpGenerator& fg, int pn)
mpz_class my;
mcl::gmp::set(my, y);
mx *= my;
- uint64_t d = fg.mul_Unit_(z, x, y);
+ uint64_t d = fg.mulUnit_(z, x, y);
z[pn] = d;
mcl::gmp::setArray(my, z, pn + 1);
CYBOZU_TEST_EQUAL(mx, my);
@@ -162,7 +162,7 @@ void testMulI(const mcl::fp::FpGenerator& fg, int pn)
uint64_t z[MAX_N + 1];
rg.read(x, pn);
uint64_t y = rg.get64();
- CYBOZU_BENCH_C("mul_Unit", 10000000, fg.mul_Unit_, z, x, y);
+ CYBOZU_BENCH_C("mulUnit", 10000000, fg.mulUnit_, z, x, y);
}
}
diff --git a/test/fp_test.cpp b/test/fp_test.cpp
index cf6dad0..05c4907 100644
--- a/test/fp_test.cpp
+++ b/test/fp_test.cpp
@@ -425,12 +425,12 @@ void powTest()
CYBOZU_TEST_EQUAL(x, 125);
}
-void mul_UnitTest()
+void mulUnitTest()
{
Fp x(-1), y, z;
for (unsigned int u = 0; u < 20; u++) {
Fp::mul(y, x, u);
- Fp::mul_Unit(z, x, u);
+ Fp::mulUnit(z, x, u);
CYBOZU_TEST_EQUAL(y, z);
}
}
@@ -812,7 +812,7 @@ void sub(mcl::fp::Mode mode)
compareTest();
moduloTest(pStr);
opeTest();
- mul_UnitTest();
+ mulUnitTest();
powTest();
powNegTest();
powFpTest();