From 70e2683eb6a1cdfe04a1adb5629ae10c136faeaf Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Fri, 25 Mar 2022 16:24:07 +0100 Subject: [PATCH] Remove trailing whitespaces --- src/Reducer.h | 10 +++++----- src/asm_gcd_unsigned.h | 4 ++-- src/callback.h | 4 ++-- src/compile_asm.cpp | 2 +- src/fast_storage.h | 6 +++--- src/integer_common.h | 2 +- src/nucomp.h | 18 +++++++++--------- src/prover_slow.h | 8 ++++---- src/util.h | 4 ++-- src/vdf.h | 12 ++++++------ src/vdf_new.h | 2 +- src/vdf_original.h | 4 ++-- src/xgcd_partial.c | 24 ++++++++++++------------ 13 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/Reducer.h b/src/Reducer.h index 7fa904fe..dc8d7dfa 100644 --- a/src/Reducer.h +++ b/src/Reducer.h @@ -45,10 +45,10 @@ unsigned int lzcnt64_hard(unsigned long long x) WEAK; namespace { const int_fast64_t THRESH{1ul << 31}; const int_fast64_t EXP_THRESH{31}; -} +} /** - * @brief The Reducer class that does custom reduce operation for VDF + * @brief The Reducer class that does custom reduce operation for VDF * repeated squaring algorithm. The implementation is based on * Akashnil VDF competition entry and further optimized for speed. */ @@ -56,14 +56,14 @@ class alignas(64) Reducer { public: /** * @brief Reducer - constructs by using reference into cg context. - */ + */ Reducer(ClassGroupContext &ctx_) : ctx(ctx_) {} ~Reducer() {} /** * @brief run - runs reduction algorithm for cg context params - */ + */ inline void run() { while (!isReduced()) { int_fast64_t a, b, c; @@ -140,7 +140,7 @@ bool bLZCHasHW=false; bLZCHasHW=has_lzcnt_hard(); bLZCChecked=true; } - + int_fast64_t lg2; if(bLZCHasHW) diff --git a/src/asm_gcd_unsigned.h b/src/asm_gcd_unsigned.h index ae392bc9..fd2ab968 100644 --- a/src/asm_gcd_unsigned.h +++ b/src/asm_gcd_unsigned.h @@ -470,8 +470,8 @@ void gcd_unsigned( #else for (int end_index=0;end_index wanted_iter) + if (iteration > wanted_iter) return ; if (iteration % kl == 0) { @@ -189,7 +189,7 @@ class FastAlgorithmCallback : public WesolowskiCallback { return &(forms[pos]); } - // We need to store: + // We need to store: // 2^16 * k + 10 * l // 2^(18 + 2*m) * k + 12 * 2^(2*m) * l void OnIteration(int type, void *data, uint64_t iteration) { diff --git a/src/compile_asm.cpp b/src/compile_asm.cpp index a01fb92c..05f2a0c6 100644 --- a/src/compile_asm.cpp +++ b/src/compile_asm.cpp @@ -44,7 +44,7 @@ int main(int argc, char** argv) { set_rounding_mode(); string filename="asm_compiled.s"; - + bool compile_avx512=false; if((argc==2)&&(strcmp(argv[1],"avx2")==0)) diff --git a/src/fast_storage.h b/src/fast_storage.h index d9526075..9a8c40ed 100644 --- a/src/fast_storage.h +++ b/src/fast_storage.h @@ -1,5 +1,5 @@ -// If 'FAST_MACHINE' is set to 1, the machine needs to have a high number +// If 'FAST_MACHINE' is set to 1, the machine needs to have a high number // of CPUs. This will optimize the runtime, // by not storing any intermediate values in main VDF worker loop. // Other threads will come back and redo the work, this @@ -80,7 +80,7 @@ class FastStorage { } } nudupl_form(y, y, D, L); - reducer.reduce(y); + reducer.reduce(y); } AddIntermediates(iter_begin); } @@ -99,7 +99,7 @@ class FastStorage { intermediates_iter += (1 << 16); } return intermediates_iter; - } + } void CalculateIntermediatesThread() { while (!stopped) { diff --git a/src/integer_common.h b/src/integer_common.h index c173f813..361d35a9 100644 --- a/src/integer_common.h +++ b/src/integer_common.h @@ -244,7 +244,7 @@ struct integer { string to_string_dec() const { string res_string; res_string.resize(mpz_sizeinbase(impl, 10)); - + mpz_get_str(&(res_string[0]), 10, impl); return res_string.c_str(); diff --git a/src/nucomp.h b/src/nucomp.h index d7f55a95..f4c3a76c 100644 --- a/src/nucomp.h +++ b/src/nucomp.h @@ -3,22 +3,22 @@ /** Copyright (C) 2012 William Hart - + Permission is hereby granted, free of charge, to any person obtaining a copy of this - software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons + software and associated documentation files (the "Software"), to deal in the Software + without restriction, including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + MIT licensing permission obtained January 13, 2020 by Chia Network Inc. from William Hart Copyright 2020 Chia Network Inc @@ -89,11 +89,11 @@ void qfb_nucomp(qfb_t r, const qfb_t f, const qfb_t g, mpz_t& D, mpz_t& L) mpz_mul(k, m, v1); mpz_fdiv_r(k, k, a1); - + if (mpz_cmp_ui(sp, 1)) { mpz_gcdext(s, v2, u2, ss, sp); - + /* k = k*u2 - v2*c2 */ mpz_mul(k, k, u2); mpz_mul(t, v2, c2); @@ -163,7 +163,7 @@ void qfb_nucomp(qfb_t r, const qfb_t f, const qfb_t g, mpz_t& D, mpz_t& L) mpz_sub(cb, cb, g->b); mpz_mul_2exp(temp, ca, 1); mpz_fdiv_r(cb, cb, temp); - + /* cc = (cb*cb - D) / (4*ca) */ mpz_mul(cc, cb, cb); mpz_sub(cc, cc, D); diff --git a/src/prover_slow.h b/src/prover_slow.h index 7b41304c..2cb18e84 100644 --- a/src/prover_slow.h +++ b/src/prover_slow.h @@ -28,10 +28,10 @@ uint64_t GetBlock(uint64_t i, uint64_t k, uint64_t T, integer& B) { return res_vector[0]; } -form GenerateWesolowski(form &y, form &x_init, - integer &D, PulmarkReducer& reducer, +form GenerateWesolowski(form &y, form &x_init, + integer &D, PulmarkReducer& reducer, std::vector
& intermediates, - uint64_t num_iterations, + uint64_t num_iterations, uint64_t k, uint64_t l) { integer B = GetB(D, x_init, y); integer L=root(-D, 4); @@ -95,7 +95,7 @@ std::vector ProveSlow(integer& D, form& x, uint64_t num_iterations) { } nudupl_form(y, y, D, L); reducer.reduce(y); - } + } form proof = GenerateWesolowski(y, x, D, reducer, intermediates, num_iterations, k, l); std::vector result = SerializeForm(y, d_bits); std::vector proof_bytes = SerializeForm(proof, d_bits); diff --git a/src/util.h b/src/util.h index a4e69963..7ae2eb04 100644 --- a/src/util.h +++ b/src/util.h @@ -46,7 +46,7 @@ struct Segment { is_empty = true; } - Segment(uint64_t start, uint64_t length, form& x, form& y) { + Segment(uint64_t start, uint64_t length, form& x, form& y) { this->start = start; this->length = length; this->x = x; @@ -62,7 +62,7 @@ struct Segment { } if (length > other.length) return true; - if (length < other.length) + if (length < other.length) return false; return start > other.start; } diff --git a/src/vdf.h b/src/vdf.h index 6c92fe6a..eb3b79c9 100644 --- a/src/vdf.h +++ b/src/vdf.h @@ -451,7 +451,7 @@ class ProverManager { while (!valid_proof && !stopped) { std::unique_lock lk(proof_mutex); proof_cv.wait(lk, [this, iteration] { - if (max_proving_iteration >= iteration - iteration % (1 << 16)) + if (max_proving_iteration >= iteration - iteration % (1 << 16)) return true; return stopped.load(); }); @@ -562,8 +562,8 @@ class ProverManager { if (provers[i].first->IsFinished()) { provers[i].second.proof = provers[i].first->GetProof(); if (debug_mode) { - std::cout << "Done segment: [" << provers[i].second.start - << ", " << provers[i].second.start + provers[i].second.length + std::cout << "Done segment: [" << provers[i].second.start + << ", " << provers[i].second.start + provers[i].second.length << "]. Bucket: " << provers[i].second.GetSegmentBucket() << ".\n"; } if (provers[i].second.length == (1 << 16)) { @@ -571,7 +571,7 @@ class ProverManager { } int index = provers[i].second.GetSegmentBucket(); int position = provers[i].second.start / provers[i].second.length; - while (done_segments[index].size() <= position) + while (done_segments[index].size() <= position) done_segments[index].emplace_back(Segment()); done_segments[index][position] = provers[i].second; if (provers[i].first->IsFullyFinished()) { @@ -588,7 +588,7 @@ class ProverManager { expected_proving_iters = done_segments[0][done_segments[0].size() - 1].start + done_segments[0][done_segments[0].size() - 1].length; } - + if (pending_iters.size() > 0) best_pending_iter = *pending_iters.begin(); if (pending_iters.size() > 0 && expected_proving_iters >= best_pending_iter - best_pending_iter % (1 << 16)) { @@ -689,7 +689,7 @@ class ProverManager { // Otherwise, pause one already running segment, if candidate is better. Segment worst_running; int worst_index; - for (int i = 0; i < provers.size(); i++) + for (int i = 0; i < provers.size(); i++) if (provers[i].first->IsRunning()) { if (worst_running.is_empty == true || provers[i].second.IsWorseThan(worst_running)) { worst_running = provers[i].second; diff --git a/src/vdf_new.h b/src/vdf_new.h index 9e9ca2bd..2d273ae0 100644 --- a/src/vdf_new.h +++ b/src/vdf_new.h @@ -131,7 +131,7 @@ struct form { static form generator(const integer& d) { return from_abd(integer(2), integer(1), d); } - + void reduce() { ::reduce(a, b, c); } diff --git a/src/vdf_original.h b/src/vdf_original.h index 183e5052..ca284cfe 100644 --- a/src/vdf_original.h +++ b/src/vdf_original.h @@ -17,7 +17,7 @@ limitations under the License. class vdf_original { public: - + struct form { // y = ax^2 + bxy + y^2 mpz_t a; @@ -321,6 +321,6 @@ class vdf_original ~vdf_original() { mpz_clears(negative_a, r, denom, old_a, old_b, ra, s, x, g, d, e, q, w, m, - u, a, b, k, mu, v, sigma, lambda, f3.a, f3.b, f3.c, NULL); //,); + u, a, b, k, mu, v, sigma, lambda, f3.a, f3.b, f3.c, NULL); //,); } }; diff --git a/src/xgcd_partial.c b/src/xgcd_partial.c index 8858cc3f..536e6c19 100644 --- a/src/xgcd_partial.c +++ b/src/xgcd_partial.c @@ -2,9 +2,9 @@ Copyright (C) 2012 William Hart Permission is hereby granted, free of charge, to any person obtaining a copy of this - software and associated documentation files (the "Software"), to deal in the Software - without restriction, including without limitation the rights to use, copy, modify, merge, - publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons + software and associated documentation files (the "Software"), to deal in the Software + without restriction, including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or @@ -16,7 +16,7 @@ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + MIT licensing permission obtained January 13, 2020 by Chia Network Inc. from William Hart */ @@ -33,17 +33,17 @@ void mpz_xgcd_partial(mpz_t co2, mpz_t co1, mp_limb_signed_t bits, bits1, bits2; mpz_init(q); mpz_init(r); - + mpz_set_ui(co2, 0); mpz_set_si(co1, -1); - + while (mpz_cmp_ui(r1, 0) && mpz_cmp(r1, L) > 0) { bits2 = mpz_sizeinbase(r2, 2); bits1 = mpz_sizeinbase(r1, 2); bits = __GMP_MAX(bits2, bits1) - GMP_LIMB_BITS + 1; if (bits < 0) bits = 0; - + mpz_tdiv_q_2exp(r, r2, bits); rr2 = mpz_get_ui(r); mpz_tdiv_q_2exp(r, r1, bits); @@ -58,14 +58,14 @@ void mpz_xgcd_partial(mpz_t co2, mpz_t co1, { qq = rr2 / rr1; - t1 = rr2 - qq*rr1; - t2 = aa2 - qq*aa1; - t3 = bb2 - qq*bb1; + t1 = rr2 - qq*rr1; + t2 = aa2 - qq*aa1; + t3 = bb2 - qq*bb1; if (i & 1) { if (t1 < -t3 || rr1 - t1 < t2 - aa1) break; - } else + } else { if (t1 < -t2 || rr1 - t1 < t3 - bb1) break; } @@ -114,7 +114,7 @@ void mpz_xgcd_partial(mpz_t co2, mpz_t co1, } if (mpz_sgn(r2) < 0) - { + { mpz_neg(co2, co2); mpz_neg(co1, co1); mpz_neg(r2, r2); }