diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2017-08-03 06:17:57 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2017-08-03 06:17:57 +0800 |
commit | 229cc0166ceefbd49fffd788c2565ab5727c0257 (patch) | |
tree | dd4b7078bf561a623b71612dcf1afd8d03960c32 | |
parent | 1099498eb474b7974e2a68b1d45acd21a48fb23b (diff) | |
download | dexon-mcl-229cc0166ceefbd49fffd788c2565ab5727c0257.tar.gz dexon-mcl-229cc0166ceefbd49fffd788c2565ab5727c0257.tar.zst dexon-mcl-229cc0166ceefbd49fffd788c2565ab5727c0257.zip |
define macro for emscripten
-rw-r--r-- | include/mcl/gmp_util.hpp | 3 | ||||
-rw-r--r-- | include/mcl/op.hpp | 4 | ||||
-rw-r--r-- | include/mcl/vint.hpp | 4 | ||||
-rw-r--r-- | test/bn_test.cpp | 6 |
4 files changed, 14 insertions, 3 deletions
diff --git a/include/mcl/gmp_util.hpp b/include/mcl/gmp_util.hpp index 84b74d5..b9ae3c5 100644 --- a/include/mcl/gmp_util.hpp +++ b/include/mcl/gmp_util.hpp @@ -22,6 +22,9 @@ #pragma warning(disable : 4512) #pragma warning(disable : 4146) #endif +#ifdef __EMSCRIPTEN__ + #define MCL_USE_VINT +#endif #ifdef MCL_USE_VINT #include <mcl/vint.hpp> typedef mcl::Vint mpz_class; diff --git a/include/mcl/op.hpp b/include/mcl/op.hpp index 9e02058..b5d7045 100644 --- a/include/mcl/op.hpp +++ b/include/mcl/op.hpp @@ -11,6 +11,10 @@ #ifndef MCL_MAX_BIT_SIZE #define MCL_MAX_BIT_SIZE 521 #endif +#ifdef __EMSCRIPTEN__ + #define MCL_DONT_USE_XBYAK + #define MCL_DONT_USE_OPENSSL +#endif #if !defined(MCL_DONT_USE_XBYAK) && (defined(_WIN64) || defined(__x86_64__)) #define MCL_USE_XBYAK #endif diff --git a/include/mcl/vint.hpp b/include/mcl/vint.hpp index fda212e..9ac7e3f 100644 --- a/include/mcl/vint.hpp +++ b/include/mcl/vint.hpp @@ -14,6 +14,10 @@ #include <iostream> #include <mcl/util.hpp> +#ifdef __EMSCRIPTEN__ + #define MCL_VINT_64BIT_PORTABLE +#endif + #ifndef MCL_SIZEOF_UNIT #if defined(CYBOZU_OS_BIT) && (CYBOZU_OS_BIT == 32) #define MCL_SIZEOF_UNIT 4 diff --git a/test/bn_test.cpp b/test/bn_test.cpp index 2ce7ba0..8637d29 100644 --- a/test/bn_test.cpp +++ b/test/bn_test.cpp @@ -252,10 +252,10 @@ void testPairing(const G1& P, const G2& Q, const char *eStr) Fp12 e = e1, ea; G1 Pa; G2 Qa; -#if MCL_SIZEOF_UNIT == 8 - const int count = 1000; -#else +#if defined(__EMSCRIPTEN__) || MCL_SIZEOF_UNIT == 4 const int count = 100; +#else + const int count = 1000; #endif mpz_class a; cybozu::XorShift rg; |