From 0b6039e66546e43848c0cc3daba3a73303cccebb Mon Sep 17 00:00:00 2001 From: fractasy Date: Tue, 19 Sep 2023 18:36:13 +0000 Subject: [PATCH] Optimize key utils --- src/utils/key_utils.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/key_utils.cpp b/src/utils/key_utils.cpp index 3413562db..2b169bb77 100644 --- a/src/utils/key_utils.cpp +++ b/src/utils/key_utils.cpp @@ -32,12 +32,12 @@ void splitKey (Goldilocks &fr, const Goldilocks::Element (&key)[4], bool (&resul void joinKey (Goldilocks &fr, const vector &bits, const Goldilocks::Element (&rkey)[4], Goldilocks::Element (&key)[4]) { uint64_t n[4] = {0, 0, 0, 0}; - mpz_class accs[4] = {0, 0, 0, 0}; + uint64_t accs[4] = {0, 0, 0, 0}; for (uint64_t i=0; i &bits, const Goldilocks::El for (uint64_t i=0; i<4; i++) auxk[i] = rkey[i]; for (uint64_t i=0; i<4; i++) { - mpz_class aux = fr.toU64(auxk[i]); - aux = ((aux< &bits, const Goldilocks::El void removeKeyBits (Goldilocks &fr, const Goldilocks::Element (&key)[4], uint64_t nBits, Goldilocks::Element (&rkey)[4]) { uint64_t fullLevels = nBits / 4; - mpz_class auxk[4]; + uint64_t auxk[4]; for (uint64_t i=0; i<4; i++) { @@ -77,7 +77,7 @@ void removeKeyBits (Goldilocks &fr, const Goldilocks::Element (&key)[4], uint64_ for (uint64_t i=0; i<4; i++) { - scalar2fe(fr, auxk[i], rkey[i]); + rkey[i] = fr.fromU64(auxk[i]); } }