diff options
Diffstat (limited to 'src/solvers/distribution.h')
| -rw-r--r-- | src/solvers/distribution.h | 27 |
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 { | |||
| 13 | STATIC void *getdistribution_runthread(void *); | 13 | STATIC void *getdistribution_runthread(void *); |
| 14 | STATIC void getdistribution(const unsigned char *, | 14 | STATIC 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]); |
| 16 | STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], | ||
| 17 | const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); | ||
| 16 | 18 | ||
| 17 | STATIC void * | 19 | STATIC void * |
| 18 | getdistribution_runthread(void *arg) | 20 | getdistribution_runthread(void *arg) |
| @@ -75,3 +77,28 @@ getdistribution( | |||
| 75 | distr[pval]++; | 77 | distr[pval]++; |
| 76 | } | 78 | } |
| 77 | } | 79 | } |
| 80 | |||
| 81 | STATIC bool | ||
| 82 | distribution_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 | } | ||
