From 388985098a09ae7fa376c68b52db30205d712bf3 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Mon, 11 Jul 2016 16:13:23 +0900 Subject: [PATCH] add bench of large prime --- sample/large.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/sample/large.cpp b/sample/large.cpp index c7902b6..f7fbd86 100644 --- a/sample/large.cpp +++ b/sample/large.cpp @@ -3,18 +3,26 @@ make CFLAGS_USER="-DMCL_MAX_OP_BIT_SIZE=768" */ #include +#include typedef mcl::FpT<> Fp; -int main() - try +void test(mcl::fp::Mode mode) { + printf("test %s\n", mcl::fp::ModeToStr(mode)); std::string pStr = "776259046150354467574489744231251277628443008558348305569526019013025476343188443165439204414323238975243865348565536603085790022057407195722143637520590569602227488010424952775132642815799222412631499596858234375446423426908029627"; - Fp::init(pStr); + Fp::init(pStr, mode); mpz_class p(pStr); - Fp a = 123456; - Fp::pow(a, a, p); - std::cout << a << std::endl; + Fp x = 123456; + Fp::pow(x, x, p); + std::cout << x << std::endl; + CYBOZU_BENCH("mul", Fp::mul, x, x, x); +} +int main() + try +{ + test(mcl::fp::FP_GMP); + test(mcl::fp::FP_GMP_MONT); } catch (std::exception& e) { printf("err %s\n", e.what()); puts("make clean");