From 62d87e063318cc4c842b1b2d8c184f48aeaf6659 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 19 May 2025 17:45:14 +0200 Subject: Refactored checkdata Relevant changes include: - Changed the signature of nissy_checkdata(). - Removed expected_distribution.h from tools; this data is now included in each solver's src/ code. - Removed distribution check for cocsep; may add back later. --- src/solvers/distribution.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src/solvers/distribution.h') diff --git a/src/solvers/distribution.h b/src/solvers/distribution.h index 1a3719c..3c006a7 100644 --- a/src/solvers/distribution.h +++ b/src/solvers/distribution.h @@ -13,6 +13,8 @@ typedef struct { STATIC void *getdistribution_runthread(void *); STATIC void getdistribution(const unsigned char *, uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); +STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], + const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); STATIC void * getdistribution_runthread(void *arg) @@ -75,3 +77,28 @@ getdistribution( distr[pval]++; } } + +STATIC bool +distribution_equal( + const uint64_t expected[static INFO_DISTRIBUTION_LEN], + const uint64_t actual[static INFO_DISTRIBUTION_LEN], + uint8_t maxvalue +) +{ + int wrong; + uint8_t i; + + for (i = 0, wrong = 0; i <= MIN(maxvalue, 20); i++) { + if (expected[i] != actual[i]) { + wrong++; + LOG("[checkdata] Value for depth %" PRIu8 + ": expected %" PRIu64 ", found %" PRIu64 "\n", + i, expected[i], actual[i]); + } else { + LOG("[checkdata] Value for depth %" PRIu8 + " is correct (%" PRIu64 ")\n", i, actual[i]); + } + } + + return wrong == 0; +} -- cgit v1.3