From fc2065606dbe50e25a128cc3d242dfe6335887be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 25 May 2026 15:49:29 +0200 Subject: [PATCH] crypto: Trivial reuse of computed values in pairing helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reuses already computed terms in trivial cases in pairing helpers. 91.4 → 92.2 (+0.83%) Mgas/s --- lib/evmone_precompiles/pairing/bn254/utils.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/evmone_precompiles/pairing/bn254/utils.hpp b/lib/evmone_precompiles/pairing/bn254/utils.hpp index 4d48aff671..ad6a13e2d8 100644 --- a/lib/evmone_precompiles/pairing/bn254/utils.hpp +++ b/lib/evmone_precompiles/pairing/bn254/utils.hpp @@ -403,11 +403,11 @@ constexpr ecc::JacPoint lin_func_and_dbl( const auto V = x0 * H_squared; const auto X3 = R_squared - H_cubed - (V + V); - const auto Y3 = R * (x0 * H_squared - X3) - y0 * H_cubed; + const auto Y3 = R * (V - X3) - y0 * H_cubed; const auto Z3 = H * z0; - t[0] = (z0 * z0_squared * x0 - U2 * z0_cubed); - t[1] = (S2 * z0_squared - y0 * z0_squared); + t[0] = z0_cubed * x0 - U2 * z0_cubed; + t[1] = S2 * z0_squared - y0 * z0_squared; t[2] = y0 * U2 - x0 * S2; return ecc::JacPoint{X3, Y3, Z3}; @@ -432,8 +432,8 @@ constexpr void lin_func( const auto U2 = x1 * z0_squared; const auto S2 = y1 * z0_cubed; - t[0] = (z0 * z0_squared * x0 - U2 * z0_cubed); - t[1] = (S2 * z0_squared - y0 * z0_squared); + t[0] = z0_cubed * x0 - U2 * z0_cubed; + t[1] = S2 * z0_squared - y0 * z0_squared; t[2] = y0 * U2 - x0 * S2; }