From 5b5b2acdd55ad6f3bb11254bfe6870be389cee16 Mon Sep 17 00:00:00 2001 From: Kevin Heifner Date: Thu, 30 Nov 2023 07:49:57 -0600 Subject: [PATCH] Fix warnings --- bench/eth_bench.cpp | 26 ++++++-------------------- test/unittests.cpp | 2 -- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/bench/eth_bench.cpp b/bench/eth_bench.cpp index 16d5b5d..05cd874 100644 --- a/bench/eth_bench.cpp +++ b/bench/eth_bench.cpp @@ -200,15 +200,10 @@ void benchG1Add2() { string testName = "G1 Addition With different settings"; cout << endl << testName << endl; - const int numIters = 10000; + constexpr int numIters = 10000; g1 pbak = random_g1(); - - - array s = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; - - - auto performTest = [numIters, s, pbak](bool check, bool raw) { + auto performTest = [pbak](bool check, bool raw) { array pRaw = {}; g1 p = pbak; p.toJacobianBytesLE(pRaw, raw); @@ -217,12 +212,10 @@ void benchG1Add2() { for (int i = 0; i < numIters; i++) { p = *g1::fromJacobianBytesLE(pRaw, check, raw); - p.add(p); + p = p.add(p); p.toJacobianBytesLE(pRaw, raw); } endStopwatch(string("check=") + std::to_string(check) + string(", raw=") + std::to_string(raw), start, numIters); - - start = startStopwatch(); }; performTest(true, true); @@ -236,15 +229,10 @@ void benchG2Add2() { string testName = "G2 Addition With different settings"; cout << endl << testName << endl; - const int numIters = 10000; + constexpr int numIters = 10000; g2 pbak = random_g2(); - - - - array s = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; - - auto performTest = [numIters, s, pbak](bool check, bool raw) { + auto performTest = [pbak](bool check, bool raw) { array pRaw = {}; g2 p = pbak; p.toJacobianBytesLE(pRaw, raw); @@ -253,12 +241,10 @@ void benchG2Add2() { for (int i = 0; i < numIters; i++) { p = *g2::fromJacobianBytesLE(pRaw, check, raw); - p.add(p); + p = p.add(p); p.toJacobianBytesLE(pRaw, raw); } endStopwatch(string("check=") + std::to_string(check) + string(", raw=") + std::to_string(raw), start, numIters); - - start = startStopwatch(); }; performTest(true, true); diff --git a/test/unittests.cpp b/test/unittests.cpp index a31eec3..1760fcf 100644 --- a/test/unittests.cpp +++ b/test/unittests.cpp @@ -987,7 +987,6 @@ void TestG1WeightedSumExpected() void TestG1WeightedSumBatch() { const auto doTest = [](int64_t n) { - g1 one = g1::one(); vector> scalars; vector bases; @@ -1312,7 +1311,6 @@ void TestG2WeightedSumExpected() void TestG2WeightedSumBatch() { const auto doTest = [](int64_t n) { - g2 one = g2::one(); vector> scalars; vector bases;