aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2016-10-28 13:19:28 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2016-10-28 13:19:28 +0800
commitd1a5107c788cf99d8089971173731379c897699a (patch)
tree8022f1d3278bddf8209914b74062803ce12d81c3
parent8a899cb3f4a5083259e497ca62a58f810e5f39b4 (diff)
downloadtangerine-mcl-d1a5107c788cf99d8089971173731379c897699a.tar.gz
tangerine-mcl-d1a5107c788cf99d8089971173731379c897699a.tar.zst
tangerine-mcl-d1a5107c788cf99d8089971173731379c897699a.zip
rename MCL_MAX_OP_BIT_SIZE to MCL_MAX_BIT_SIZE
-rw-r--r--include/mcl/fp.hpp4
-rw-r--r--include/mcl/op.hpp6
-rw-r--r--java/mcl_if.hpp2
-rw-r--r--misc/karatsuba.cpp2
-rw-r--r--sample/large.cpp4
-rw-r--r--src/fp.cpp6
-rw-r--r--src/fp_proto.hpp2
-rw-r--r--src/gen.cpp2
-rw-r--r--test/fp_tower_test.cpp6
9 files changed, 17 insertions, 17 deletions
diff --git a/include/mcl/fp.hpp b/include/mcl/fp.hpp
index 7f93a05..233949e 100644
--- a/include/mcl/fp.hpp
+++ b/include/mcl/fp.hpp
@@ -86,7 +86,7 @@ Mode StrToMode(const std::string& s);
} // mcl::fp
-template<class tag = FpTag, size_t maxBitSize = MCL_MAX_OP_BIT_SIZE>
+template<class tag = FpTag, size_t maxBitSize = MCL_MAX_BIT_SIZE>
class FpT : public fp::Operator<FpT<tag, maxBitSize> > {
typedef fp::Unit Unit;
typedef fp::Operator<FpT<tag, maxBitSize> > Operator;
@@ -123,7 +123,7 @@ public:
}
static inline void init(const std::string& mstr, fp::Mode mode = fp::FP_AUTO)
{
- assert(maxBitSize <= MCL_MAX_OP_BIT_SIZE);
+ assert(maxBitSize <= MCL_MAX_BIT_SIZE);
op_.init(mstr, maxBitSize, mode);
{ // set oneRep
FpT& one = *reinterpret_cast<FpT*>(op_.oneRep);
diff --git a/include/mcl/op.hpp b/include/mcl/op.hpp
index b1457df..920c74c 100644
--- a/include/mcl/op.hpp
+++ b/include/mcl/op.hpp
@@ -8,8 +8,8 @@
*/
#include <mcl/gmp_util.hpp>
-#ifndef MCL_MAX_OP_BIT_SIZE
- #define MCL_MAX_OP_BIT_SIZE 521
+#ifndef MCL_MAX_BIT_SIZE
+ #define MCL_MAX_BIT_SIZE 521
#endif
#if !defined(MCL_DONT_USE_XBYAK) && (defined(_WIN64) || defined(__x86_64__))
#define MCL_USE_XBYAK
@@ -26,7 +26,7 @@ typedef uint64_t Unit;
#endif
const size_t UnitBitSize = sizeof(Unit) * 8;
-const size_t maxOpUnitSize = (MCL_MAX_OP_BIT_SIZE + UnitBitSize - 1) / UnitBitSize;
+const size_t maxOpUnitSize = (MCL_MAX_BIT_SIZE + UnitBitSize - 1) / UnitBitSize;
struct FpGenerator;
struct Op;
diff --git a/java/mcl_if.hpp b/java/mcl_if.hpp
index 832e5b3..034c7ad 100644
--- a/java/mcl_if.hpp
+++ b/java/mcl_if.hpp
@@ -1,5 +1,5 @@
#pragma once
-//#define MCL_MAX_OP_BIT_SIZE 521
+//#define MCL_MAX_BIT_SIZE 521
#include <iostream>
#include <fstream>
#include <cybozu/random_generator.hpp>
diff --git a/misc/karatsuba.cpp b/misc/karatsuba.cpp
index 5e3567c..8c05378 100644
--- a/misc/karatsuba.cpp
+++ b/misc/karatsuba.cpp
@@ -50,7 +50,7 @@ CYBOZU_TEST_AUTO(karatsuba)
benchKaratsuba<4>();
benchKaratsuba<6>();
benchKaratsuba<8>();
-#if MCL_MAX_OP_BIT_SIZE == 768
+#if MCL_MAX_BIT_SIZE == 768
benchKaratsuba<10>();
benchKaratsuba<12>();
#endif
diff --git a/sample/large.cpp b/sample/large.cpp
index 5436cc1..9991bd5 100644
--- a/sample/large.cpp
+++ b/sample/large.cpp
@@ -1,6 +1,6 @@
/*
large prime sample for 64-bit arch
- make MCL_USE_LLVM=1 MCL_MAX_OP_BIT_SIZE=768
+ make MCL_USE_LLVM=1 MCL_MAX_BIT_SIZE=768
*/
#include <mcl/fp.hpp>
#include <cybozu/benchmark.hpp>
@@ -119,7 +119,7 @@ int main()
} catch (std::exception& e) {
printf("err %s\n", e.what());
puts("make clean");
- puts("make -DMCL_MAX_OP_BIT_SIZE=768");
+ puts("make -DMCL_MAX_BIT_SIZE=768");
return 1;
}
diff --git a/src/fp.cpp b/src/fp.cpp
index ab2b193..1cf12b4 100644
--- a/src/fp.cpp
+++ b/src/fp.cpp
@@ -300,8 +300,8 @@ void Op::init(const std::string& mstr, size_t maxBitSize, Mode mode)
#endif
"\n", ModeToStr(mode), isMont, (int)maxBitSize);
#endif
- if (maxBitSize > MCL_MAX_OP_BIT_SIZE) {
- throw cybozu::Exception("Op:init:too large maxBitSize") << maxBitSize << MCL_MAX_OP_BIT_SIZE;
+ if (maxBitSize > MCL_MAX_BIT_SIZE) {
+ throw cybozu::Exception("Op:init:too large maxBitSize") << maxBitSize << MCL_MAX_BIT_SIZE;
}
bool isMinus = fp::strToMpzArray(&bitSize, p, maxBitSize, mp, mstr, 0);
if (isMinus) throw cybozu::Exception("Op:init:mstr is minus") << mstr;
@@ -334,7 +334,7 @@ void Op::init(const std::string& mstr, size_t maxBitSize, Mode mode)
case 7: setOp<7>(*this, mode); break;
case 8: setOp<8>(*this, mode); break;
case 9: setOp<9>(*this, mode); break; // 576 if 64-bit
-#if CYBOZU_OS_BIT == 32 || MCL_MAX_OP_BIT_SIZE == 768
+#if CYBOZU_OS_BIT == 32 || MCL_MAX_BIT_SIZE == 768
case 10: setOp<10>(*this, mode); break;
case 11: setOp<11>(*this, mode); break;
case 12: setOp<12>(*this, mode); break; // 768 if 64-bit
diff --git a/src/fp_proto.hpp b/src/fp_proto.hpp
index a6845e2..67faff3 100644
--- a/src/fp_proto.hpp
+++ b/src/fp_proto.hpp
@@ -471,7 +471,7 @@ MCL_FP_DEF_FUNC(6)
MCL_FP_DEF_FUNC(7)
MCL_FP_DEF_FUNC(8)
MCL_FP_DEF_FUNC(9)
-#if CYBOZU_OS_BIT == 32 || MCL_MAX_OP_BIT_SIZE == 768
+#if CYBOZU_OS_BIT == 32 || MCL_MAX_BIT_SIZE == 768
MCL_FP_DEF_FUNC(10)
MCL_FP_DEF_FUNC(11)
MCL_FP_DEF_FUNC(12)
diff --git a/src/gen.cpp b/src/gen.cpp
index f9595c7..cb9e9db 100644
--- a/src/gen.cpp
+++ b/src/gen.cpp
@@ -840,7 +840,7 @@ int main(int argc, char *argv[])
c.setOldLLVM();
}
c.setUnit(unit);
- uint32_t maxBitSize = MCL_MAX_OP_BIT_SIZE;
+ uint32_t maxBitSize = MCL_MAX_BIT_SIZE;
c.gen(privateFuncList, maxBitSize);
} catch (std::exception& e) {
printf("ERR %s\n", e.what());
diff --git a/test/fp_tower_test.cpp b/test/fp_tower_test.cpp
index 165f635..4b5ed2d 100644
--- a/test/fp_tower_test.cpp
+++ b/test/fp_tower_test.cpp
@@ -7,7 +7,7 @@
#include <mcl/fp.hpp>
#include <mcl/fp_tower.hpp>
-#if MCL_MAX_OP_BIT_SIZE == 768
+#if MCL_MAX_BIT_SIZE == 768
typedef mcl::FpT<mcl::FpTag, 768> Fp;
#else
typedef mcl::FpT<mcl::FpTag, 256> Fp;
@@ -23,7 +23,7 @@ void testFp2()
{
using namespace mcl;
puts(__FUNCTION__);
-#if MCL_MAX_OP_BIT_SIZE != 768
+#if MCL_MAX_BIT_SIZE != 768
CYBOZU_TEST_EQUAL(sizeof(Fp), 32);
CYBOZU_TEST_EQUAL(sizeof(Fp2), 32 * 2);
CYBOZU_TEST_EQUAL(sizeof(Fp6), 32 * 6);
@@ -412,7 +412,7 @@ void testAll()
"0x7523648240000001ba344d80000000086121000000000013a700000000000017",
"0x800000000000000000000000000000000000000000000000000000000000005f",
"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff43", // max prime
-#if MCL_MAX_OP_BIT_SIZE == 768
+#if MCL_MAX_BIT_SIZE == 768
"776259046150354467574489744231251277628443008558348305569526019013025476343188443165439204414323238975243865348565536603085790022057407195722143637520590569602227488010424952775132642815799222412631499596858234375446423426908029627",
#endif
};