diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nissy.c | 10 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 20 |
2 files changed, 13 insertions, 17 deletions
diff --git a/src/nissy.c b/src/nissy.c index 953471f..2eed1b5 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -13,8 +13,8 @@ | |||
| 13 | 13 | ||
| 14 | int parse_h48_options(const char *, uint8_t *, uint8_t *, uint8_t *); | 14 | int parse_h48_options(const char *, uint8_t *, uint8_t *, uint8_t *); |
| 15 | STATIC int64_t write_result(cube_t, char [static 22]); | 15 | STATIC int64_t write_result(cube_t, char [static 22]); |
| 16 | STATIC bool distribution_equal( | 16 | STATIC bool distribution_equal(const uint64_t [static INFO_DISTRIBUTION_LEN], |
| 17 | const uint64_t [static 21], const uint64_t [static 21], uint8_t); | 17 | const uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t); |
| 18 | STATIC bool checkdata(const void *, const tableinfo_t *); | 18 | STATIC bool checkdata(const void *, const tableinfo_t *); |
| 19 | 19 | ||
| 20 | /* TODO: add option to get DR, maybe C-only, E-only, eo... */ | 20 | /* TODO: add option to get DR, maybe C-only, E-only, eo... */ |
| @@ -68,7 +68,7 @@ parse_h48_options_error: | |||
| 68 | STATIC bool | 68 | STATIC bool |
| 69 | checkdata(const void *buf, const tableinfo_t *info) | 69 | checkdata(const void *buf, const tableinfo_t *info) |
| 70 | { | 70 | { |
| 71 | uint64_t distr[21]; | 71 | uint64_t distr[INFO_DISTRIBUTION_LEN]; |
| 72 | 72 | ||
| 73 | if (!strncmp(info->solver, "cocsep", 6)) { | 73 | if (!strncmp(info->solver, "cocsep", 6)) { |
| 74 | getdistribution_cocsep( | 74 | getdistribution_cocsep( |
| @@ -86,8 +86,8 @@ checkdata(const void *buf, const tableinfo_t *info) | |||
| 86 | 86 | ||
| 87 | STATIC bool | 87 | STATIC bool |
| 88 | distribution_equal( | 88 | distribution_equal( |
| 89 | const uint64_t expected[static 21], | 89 | const uint64_t expected[static INFO_DISTRIBUTION_LEN], |
| 90 | const uint64_t actual[static 21], | 90 | const uint64_t actual[static INFO_DISTRIBUTION_LEN], |
| 91 | uint8_t maxvalue | 91 | uint8_t maxvalue |
| 92 | ) | 92 | ) |
| 93 | { | 93 | { |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 48d5582..b1ae38c 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -104,8 +104,8 @@ STATIC size_t gendata_h48k2_realcoord(gendata_h48_arg_t *); | |||
| 104 | STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t *arg); | 104 | STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t *arg); |
| 105 | STATIC void * gendata_h48k2_runthread(void *); | 105 | STATIC void * gendata_h48k2_runthread(void *); |
| 106 | STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t *); | 106 | STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t *); |
| 107 | STATIC void getdistribution_h48( | 107 | STATIC void getdistribution_h48(const uint8_t *, |
| 108 | const uint8_t *, uint64_t [static 21], uint8_t, uint8_t); | 108 | uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t); |
| 109 | 109 | ||
| 110 | STATIC uint32_t *get_cocsepdata_ptr(const void *); | 110 | STATIC uint32_t *get_cocsepdata_ptr(const void *); |
| 111 | STATIC uint8_t *get_h48data_ptr(const void *); | 111 | STATIC uint8_t *get_h48data_ptr(const void *); |
| @@ -671,14 +671,14 @@ makeinfo_h48k2(gendata_h48_arg_t *arg) | |||
| 671 | STATIC void | 671 | STATIC void |
| 672 | getdistribution_h48( | 672 | getdistribution_h48( |
| 673 | const uint8_t *table, | 673 | const uint8_t *table, |
| 674 | uint64_t distr[static 21], | 674 | uint64_t distr[static INFO_DISTRIBUTION_LEN], |
| 675 | uint8_t h, | 675 | uint8_t h, |
| 676 | uint8_t k | 676 | uint8_t k |
| 677 | ) { | 677 | ) { |
| 678 | uint8_t val; | 678 | uint8_t val; |
| 679 | int64_t i, h48max; | 679 | int64_t i, h48max; |
| 680 | 680 | ||
| 681 | memset(distr, 0, 21 * sizeof(uint64_t)); | 681 | memset(distr, 0, INFO_DISTRIBUTION_LEN * sizeof(uint64_t)); |
| 682 | 682 | ||
| 683 | h48max = H48_COORDMAX(h); | 683 | h48max = H48_COORDMAX(h); |
| 684 | for (i = 0; i < h48max; i++) { | 684 | for (i = 0; i < h48max; i++) { |
| @@ -725,12 +725,13 @@ size_t | |||
| 725 | gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) | 725 | gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) |
| 726 | { | 726 | { |
| 727 | size_t cocsepsize, h48size; | 727 | size_t cocsepsize, h48size; |
| 728 | uint8_t val_full, val_derive, val_new, *h48full, *h48derive; | 728 | uint8_t val_full, val_derive, *h48full, *h48derive; |
| 729 | int64_t i, j, h48max; | 729 | int64_t i, j, h48max; |
| 730 | gendata_h48_arg_t arg; | 730 | gendata_h48_arg_t arg; |
| 731 | tableinfo_t cocsepinfo, fulltableinfo; | 731 | tableinfo_t cocsepinfo, fulltableinfo; |
| 732 | 732 | ||
| 733 | /* Initializing values in case of error */ | 733 | /* Initializing values in case of error */ |
| 734 | /* TODO cleanup this */ | ||
| 734 | fulltableinfo.bits = 2; | 735 | fulltableinfo.bits = 2; |
| 735 | fulltableinfo.base = 8; | 736 | fulltableinfo.base = 8; |
| 736 | 737 | ||
| @@ -777,15 +778,10 @@ gendata_h48_derive(uint8_t h, const void *fulltable, void *buf) | |||
| 777 | j = i >> (int64_t)(11-h); | 778 | j = i >> (int64_t)(11-h); |
| 778 | val_full = get_h48_pval(h48full, i, arg.k); | 779 | val_full = get_h48_pval(h48full, i, arg.k); |
| 779 | val_derive = get_h48_pval(h48derive, j, arg.k); | 780 | val_derive = get_h48_pval(h48derive, j, arg.k); |
| 780 | val_new = MIN(val_full, val_derive); | 781 | set_h48_pval(h48derive, j, arg.k, MIN(val_full, val_derive)); |
| 781 | set_h48_pval(h48derive, j, arg.k, val_new); | ||
| 782 | } | 782 | } |
| 783 | 783 | ||
| 784 | h48max = H48_COORDMAX(h); | 784 | getdistribution_h48(h48derive, arg.info.distribution, h, arg.k); |
| 785 | for (i = 0; i < h48max; i++) { | ||
| 786 | val_derive = get_h48_pval(h48derive, i, arg.k); | ||
| 787 | arg.info.distribution[val_derive]++; | ||
| 788 | } | ||
| 789 | 785 | ||
| 790 | if (!writetableinfo(&arg.info, buf)) { | 786 | if (!writetableinfo(&arg.info, buf)) { |
| 791 | LOG("gendata_h48_derive: could not write info for table\n"); | 787 | LOG("gendata_h48_derive: could not write info for table\n"); |
