aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/distribution.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-05-19 17:45:14 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-05-19 17:45:14 +0200
commit62d87e063318cc4c842b1b2d8c184f48aeaf6659 (patch)
tree832bf338232c477975bea69f7370ca13f350fb07 /src/solvers/distribution.h
parent8b94d135429a9f3253cc7f25a1453b412065c4a0 (diff)
downloadnissy-core-62d87e063318cc4c842b1b2d8c184f48aeaf6659.tar.gz
nissy-core-62d87e063318cc4c842b1b2d8c184f48aeaf6659.zip
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.
Diffstat (limited to 'src/solvers/distribution.h')
-rw-r--r--src/solvers/distribution.h27
1 files changed, 27 insertions, 0 deletions
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 {
13STATIC void *getdistribution_runthread(void *); 13STATIC void *getdistribution_runthread(void *);
14STATIC void getdistribution(const unsigned char *, 14STATIC void getdistribution(const unsigned char *,
15 uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); 15 uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]);
16STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN],
17 const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t);
16 18
17STATIC void * 19STATIC void *
18getdistribution_runthread(void *arg) 20getdistribution_runthread(void *arg)
@@ -75,3 +77,28 @@ getdistribution(
75 distr[pval]++; 77 distr[pval]++;
76 } 78 }
77} 79}
80
81STATIC bool
82distribution_equal(
83 const uint64_t expected[static INFO_DISTRIBUTION_LEN],
84 const uint64_t actual[static INFO_DISTRIBUTION_LEN],
85 uint8_t maxvalue
86)
87{
88 int wrong;
89 uint8_t i;
90
91 for (i = 0, wrong = 0; i <= MIN(maxvalue, 20); i++) {
92 if (expected[i] != actual[i]) {
93 wrong++;
94 LOG("[checkdata] Value for depth %" PRIu8
95 ": expected %" PRIu64 ", found %" PRIu64 "\n",
96 i, expected[i], actual[i]);
97 } else {
98 LOG("[checkdata] Value for depth %" PRIu8
99 " is correct (%" PRIu64 ")\n", i, actual[i]);
100 }
101 }
102
103 return wrong == 0;
104}

Generated with cgit - Back to sebastiano.tronto.net