From 0a364db2fdd28498ab7cb6872eb8a1513e2636cb Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Tue, 11 Oct 2016 15:43:39 +0900 Subject: [PATCH] fix ; test fp_addNC if enable --- sample/large.cpp | 8 +++++--- sample/rawbench.cpp | 9 +++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/sample/large.cpp b/sample/large.cpp index cd79412..eb8d4e5 100644 --- a/sample/large.cpp +++ b/sample/large.cpp @@ -11,7 +11,7 @@ typedef mcl::FpT<> Fp; typedef mcl::fp::Unit Unit; using namespace mcl::fp; -#include "../src/low_gmp.hpp" +//#include "../src/low_gmp.hpp" const size_t N = 12; #if 0 @@ -110,8 +110,10 @@ void test(const std::string& pStr, mcl::fp::Mode mode) CYBOZU_BENCH("sqrPre", op.fpDbl_sqrPre, ux, ux); CYBOZU_BENCH("add", op.fpDbl_add, ux, ux, ux, op.p); CYBOZU_BENCH("sub", op.fpDbl_sub, ux, ux, ux, op.p); - CYBOZU_BENCH("addNC", op.fpDbl_addNC, ux, ux, ux); - CYBOZU_BENCH("subNC", op.fpDbl_subNC, ux, ux, ux); + if (op.fpDbl_addNC) { + CYBOZU_BENCH("addNC", op.fpDbl_addNC, ux, ux, ux); + CYBOZU_BENCH("subNC", op.fpDbl_subNC, ux, ux, ux); + } CYBOZU_BENCH("mont", op.fpDbl_mod, ux, ux, op.p); CYBOZU_BENCH("mul", Fp::mul, x, x, x); compareGmp(pStr); diff --git a/sample/rawbench.cpp b/sample/rawbench.cpp index ddfe733..e911019 100644 --- a/sample/rawbench.cpp +++ b/sample/rawbench.cpp @@ -38,8 +38,13 @@ void benchRaw(const char *p, mcl::fp::Mode mode) double fp2_sqrT, fp2_mulT; CYBOZU_BENCH_T(fp_addT, op.fp_add, uz, ux, uy, op.p); CYBOZU_BENCH_T(fp_subT, op.fp_sub, uz, uy, ux, op.p); - CYBOZU_BENCH_T(fp_addNCT, op.fp_addNC, uz, ux, uy); - CYBOZU_BENCH_T(fp_subNCT, op.fp_subNC, uz, uy, ux); + if (op.fp_addNC) { + CYBOZU_BENCH_T(fp_addNCT, op.fp_addNC, uz, ux, uy); + CYBOZU_BENCH_T(fp_subNCT, op.fp_subNC, uz, uy, ux); + } else { + fp_addNCT = 0; + fp_subNCT = 0; + } 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);