aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-07-31 11:44:23 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-07-31 11:44:23 +0800
commit433203a446082e33cc160443e236b6818d5719d8 (patch)
treec696251542ff80a534dcc8860f4e146c13df9108 /src
parent585ac4f329647389e7d2fb7824cb9d1f23121eda (diff)
downloadtangerine-mcl-433203a446082e33cc160443e236b6818d5719d8.tar.gz
tangerine-mcl-433203a446082e33cc160443e236b6818d5719d8.tar.zst
tangerine-mcl-433203a446082e33cc160443e236b6818d5719d8.zip
use MCL_SIZEOF_UNIT macro instead of CYBOZU_OS_BIT
Diffstat (limited to 'src')
-rw-r--r--src/fp.cpp12
-rw-r--r--src/fp_generator.hpp2
-rw-r--r--src/low_func.hpp4
-rw-r--r--src/low_func_llvm.hpp6
4 files changed, 12 insertions, 12 deletions
diff --git a/src/fp.cpp b/src/fp.cpp
index 85e407f..a6d43d2 100644
--- a/src/fp.cpp
+++ b/src/fp.cpp
@@ -47,7 +47,7 @@ void Op::destroyFpGenerator(FpGenerator *)
inline void setUnitAsLE(void *p, Unit x)
{
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
cybozu::Set32bitAsLE(p, x);
#else
cybozu::Set64bitAsLE(p, x);
@@ -55,7 +55,7 @@ inline void setUnitAsLE(void *p, Unit x)
}
inline Unit getUnitAsLE(const void *p)
{
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
return cybozu::Get32bitAsLE(p);
#else
return cybozu::Get64bitAsLE(p);
@@ -128,7 +128,7 @@ Mode StrToMode(const std::string& s)
void dumpUnit(Unit x)
{
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
printf("%08x", (uint32_t)x);
#else
printf("%016llx", (unsigned long long)x);
@@ -136,7 +136,7 @@ void dumpUnit(Unit x)
}
void UnitToHex(char *buf, size_t maxBufSize, Unit x)
{
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
CYBOZU_SNPRINTF(buf, maxBufSize, "%08x", (uint32_t)x);
#else
CYBOZU_SNPRINTF(buf, maxBufSize, "%016llx ", (unsigned long long)x);
@@ -516,7 +516,7 @@ void Op::init(const std::string& mstr, size_t maxBitSize, Mode mode, size_t mclM
case 17: setOp<17>(*this, mode); break; // 521 if 32-bit
#endif
default:
- throw cybozu::Exception("Op::init:not:support") << N << mstr;
+ throw cybozu::Exception("Op:init:not:support") << N << mstr;
}
#ifdef MCL_USE_LLVM
if (primeMode == PM_NICT_P192) {
@@ -655,7 +655,7 @@ static bool isInUint64(uint64_t *pv, const fp::Block& b)
for (size_t i = start; i < b.n; i++) {
if (b.p[i]) return false;
}
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
*pv = b.p[0] | (uint64_t(b.p[1]) << 32);
#else
*pv = b.p[0];
diff --git a/src/fp_generator.hpp b/src/fp_generator.hpp
index e7b1ec9..7011f21 100644
--- a/src/fp_generator.hpp
+++ b/src/fp_generator.hpp
@@ -10,7 +10,7 @@
#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak_util.h>
-#if CYBOZU_OS_BIT == 64
+#if MCL_SIZEOF_UNIT == 8
#include <stdio.h>
#include <assert.h>
#include <cybozu/exception.hpp>
diff --git a/src/low_func.hpp b/src/low_func.hpp
index a482bf2..232f9eb 100644
--- a/src/low_func.hpp
+++ b/src/low_func.hpp
@@ -545,7 +545,7 @@ template<size_t N, bool isFullBit, class Tag = Gtag>
struct Mont {
static inline void func(Unit *z, const Unit *x, const Unit *y, const Unit *p)
{
-#if MCL_MAX_BIT_SIZE == 1024 || CYBOZU_OS_BIT == 32 // check speed
+#if MCL_MAX_BIT_SIZE == 1024 || MCL_SIZEOF_UNIT == 4 // check speed
Unit xy[N * 2];
MulPre<N, Tag>::f(xy, x, y);
MontRed<N, Tag>::f(z, xy, p);
@@ -629,7 +629,7 @@ template<size_t N, bool isFullBit, class Tag = Gtag>
struct SqrMont {
static inline void func(Unit *y, const Unit *x, const Unit *p)
{
-#if MCL_MAX_BIT_SIZE == 1024 || CYBOZU_OS_BIT == 32 // check speed
+#if MCL_MAX_BIT_SIZE == 1024 || MCL_SIZEOF_UNIT == 4 // check speed
Unit xx[N * 2];
SqrPre<N, Tag>::f(xx, x);
MontRed<N, Tag>::f(y, xx, p);
diff --git a/src/low_func_llvm.hpp b/src/low_func_llvm.hpp
index 1eb61cc..104b7fa 100644
--- a/src/low_func_llvm.hpp
+++ b/src/low_func_llvm.hpp
@@ -4,7 +4,7 @@ namespace mcl { namespace fp {
template<>
struct EnableKaratsuba<Ltag> {
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
static const size_t minMulN = 10;
static const size_t minSqrN = 10;
#else
@@ -13,7 +13,7 @@ struct EnableKaratsuba<Ltag> {
#endif
};
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
#define MCL_GMP_IS_FASTER_THAN_LLVM // QQQ : check later
#endif
@@ -78,7 +78,7 @@ MCL_DEF_LLVM_FUNC(14)
#endif
#if MCL_MAX_UNIT_SIZE >= 16
MCL_DEF_LLVM_FUNC(15)
-#if CYBOZU_OS_BIT == 32
+#if MCL_SIZEOF_UNIT == 4
MCL_DEF_LLVM_FUNC(16)
#else
/// QQQ : check speed