rename low_funct.hpp to low_func_wasm.hpp

update-fork
MITSUNARI Shigeo 4 years ago
parent dc8964db5a
commit c0be1e91ce
  1. 2
      misc/Makefile
  2. 2
      misc/low_test.cpp
  3. 10
      src/fp.cpp
  4. 0
      src/low_func_wasm.hpp

@ -2,5 +2,5 @@ all: low_test
CFLAGS=-I ../include/ -m32 -Ofast -Wall -Wextra -DNDEBUG CFLAGS=-I ../include/ -m32 -Ofast -Wall -Wextra -DNDEBUG
low_test: low_test.cpp ../src/low_funct.hpp low_test: low_test.cpp ../src/low_func_wasm.hpp
$(CXX) -o low_test low_test.cpp $(CFLAGS) $(CXX) -o low_test low_test.cpp $(CFLAGS)

@ -9,7 +9,7 @@ void dump(const char *msg, const uint32_t *x, size_t n)
} }
printf("\n"); printf("\n");
} }
#include "../src/low_funct.hpp" #include "../src/low_func_wasm.hpp"
#define MCL_USE_VINT #define MCL_USE_VINT
#define MCL_VINT_FIXED_BUFFER #define MCL_VINT_FIXED_BUFFER

@ -4,8 +4,8 @@
#include <cybozu/endian.hpp> #include <cybozu/endian.hpp>
#include <mcl/conversion.hpp> #include <mcl/conversion.hpp>
#if defined(__EMSCRIPTEN__) && MCL_SIZEOF_UNIT == 4 #if defined(__EMSCRIPTEN__) && MCL_SIZEOF_UNIT == 4
#define FOR_WASM #define USE_WASM
#include "low_funct.hpp" #include "low_func_wasm.hpp"
#endif #endif
#if defined(MCL_STATIC_CODE) || defined(MCL_USE_XBYAK) || (defined(MCL_USE_LLVM) && (CYBOZU_HOST == CYBOZU_HOST_INTEL)) #if defined(MCL_STATIC_CODE) || defined(MCL_USE_XBYAK) || (defined(MCL_USE_LLVM) && (CYBOZU_HOST == CYBOZU_HOST_INTEL))
@ -411,12 +411,12 @@ static bool initForMont(Op& op, const Unit *p, Mode mode)
return true; return true;
} }
#ifdef FOR_WASM #ifdef USE_WASM
template<size_t N> template<size_t N>
void setWasmOp(Op& op) void setWasmOp(Op& op)
{ {
if (!(op.isMont && !op.isFullBit)) return; if (!(op.isMont && !op.isFullBit)) return;
EM_ASM({console.log($0)}, N); //EM_ASM({console.log($0)}, N);
// op.fp_addPre = mcl::addT<N>; // op.fp_addPre = mcl::addT<N>;
// op.fp_subPre = mcl::subT<N>; // op.fp_subPre = mcl::subT<N>;
// op.fpDbl_addPre = mcl::addT<N * 2>; // op.fpDbl_addPre = mcl::addT<N * 2>;
@ -570,7 +570,7 @@ bool Op::init(const mpz_class& _p, size_t maxBitSize, int _xi_a, Mode mode, size
default: default:
return false; return false;
} }
#ifdef FOR_WASM #ifdef USE_WASM
if (N == 8) { if (N == 8) {
setWasmOp<8>(*this); setWasmOp<8>(*this);
} else if (N == 12) { } else if (N == 12) {

Loading…
Cancel
Save