diff options
Diffstat (limited to 'src/solvers/h48')
| -rw-r--r-- | src/solvers/h48/coordinate.h | 21 | ||||
| -rw-r--r-- | src/solvers/h48/coordinate_types_macros.h (renamed from src/solvers/h48/coordinate_macros.h) | 0 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_cocsep.h | 39 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_eoesep.h | 17 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 61 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_types_macros.h | 2 | ||||
| -rw-r--r-- | src/solvers/h48/h48.h | 4 | ||||
| -rw-r--r-- | src/solvers/h48/map.h | 31 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 18 |
9 files changed, 102 insertions, 91 deletions
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h index 6caac2a..eb08fd8 100644 --- a/src/solvers/h48/coordinate.h +++ b/src/solvers/h48/coordinate.h | |||
| @@ -1,12 +1,15 @@ | |||
| 1 | /* Macros defined in a separate file for easier testing */ | 1 | STATIC_INLINE int64_t coord_h48( |
| 2 | #include "coordinate_macros.h" | 2 | cube_t, const uint32_t [static COCSEP_TABLESIZE], uint8_t); |
| 3 | |||
| 4 | STATIC_INLINE int64_t coord_h48(cube_t, const uint32_t *, uint8_t); | ||
| 5 | STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t); | 3 | STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t); |
| 6 | STATIC_INLINE cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); | 4 | STATIC_INLINE cube_t invcoord_h48( |
| 5 | int64_t, const cube_t [static COCSEP_CLASSES], uint8_t); | ||
| 7 | 6 | ||
| 8 | STATIC_INLINE int64_t | 7 | STATIC_INLINE int64_t |
| 9 | coord_h48(cube_t c, const uint32_t *cocsepdata, uint8_t h) | 8 | coord_h48( |
| 9 | cube_t c, | ||
| 10 | const uint32_t cocsepdata[static COCSEP_TABLESIZE], | ||
| 11 | uint8_t h | ||
| 12 | ) | ||
| 10 | { | 13 | { |
| 11 | int64_t cocsep, coclass; | 14 | int64_t cocsep, coclass; |
| 12 | uint32_t data; | 15 | uint32_t data; |
| @@ -42,7 +45,11 @@ the given value, because it works up to symmetry. This means that the | |||
| 42 | returned cube is a transformed cube of one that gives the correct value. | 45 | returned cube is a transformed cube of one that gives the correct value. |
| 43 | */ | 46 | */ |
| 44 | STATIC_INLINE cube_t | 47 | STATIC_INLINE cube_t |
| 45 | invcoord_h48(int64_t i, const cube_t *crep, uint8_t h) | 48 | invcoord_h48( |
| 49 | int64_t i, | ||
| 50 | const cube_t crep[static COCSEP_CLASSES], | ||
| 51 | uint8_t h | ||
| 52 | ) | ||
| 46 | { | 53 | { |
| 47 | cube_t ret; | 54 | cube_t ret; |
| 48 | int64_t hh, coclass, ee, esep, eo; | 55 | int64_t hh, coclass, ee, esep, eo; |
diff --git a/src/solvers/h48/coordinate_macros.h b/src/solvers/h48/coordinate_types_macros.h index 04462d6..04462d6 100644 --- a/src/solvers/h48/coordinate_macros.h +++ b/src/solvers/h48/coordinate_types_macros.h | |||
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index bf67962..cda1608 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -1,11 +1,15 @@ | |||
| 1 | STATIC_INLINE bool gendata_cocsep_get_visited(const uint8_t *, int64_t); | ||
| 2 | STATIC_INLINE void gendata_cocsep_set_visited(uint8_t *, int64_t); | ||
| 3 | |||
| 4 | STATIC size_t gendata_cocsep(char *, uint64_t *, cube_t *); | 1 | STATIC size_t gendata_cocsep(char *, uint64_t *, cube_t *); |
| 5 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *); | 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); |
| 6 | STATIC void getdistribution_cocsep(const uint32_t *, uint64_t [static 21]); | 3 | STATIC void getdistribution_cocsep( |
| 4 | const uint32_t [static COCSEP_TABLESIZE], uint64_t [static 21]); | ||
| 5 | |||
| 6 | STATIC_INLINE bool gendata_cocsep_get_visited( | ||
| 7 | const uint8_t [static COCSEP_VISITEDSIZE], int64_t); | ||
| 8 | STATIC_INLINE void gendata_cocsep_set_visited( | ||
| 9 | uint8_t [static COCSEP_VISITEDSIZE], int64_t); | ||
| 7 | 10 | ||
| 8 | STATIC_INLINE int8_t get_h48_cdata(cube_t, const uint32_t *, uint32_t *); | 11 | STATIC_INLINE int8_t get_h48_cdata( |
| 12 | cube_t, const uint32_t [static COCSEP_TABLESIZE], uint32_t *); | ||
| 9 | 13 | ||
| 10 | STATIC size_t | 14 | STATIC size_t |
| 11 | gendata_cocsep( | 15 | gendata_cocsep( |
| @@ -78,7 +82,7 @@ gendata_cocsep_return_size: | |||
| 78 | } | 82 | } |
| 79 | 83 | ||
| 80 | STATIC uint32_t | 84 | STATIC uint32_t |
| 81 | gendata_cocsep_dfs(cocsep_dfs_arg_t *arg) | 85 | gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) |
| 82 | { | 86 | { |
| 83 | uint8_t m; | 87 | uint8_t m; |
| 84 | uint32_t cc, class, ttrep, depth, olddepth, tinv; | 88 | uint32_t cc, class, ttrep, depth, olddepth, tinv; |
| @@ -133,7 +137,10 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t *arg) | |||
| 133 | } | 137 | } |
| 134 | 138 | ||
| 135 | STATIC void | 139 | STATIC void |
| 136 | getdistribution_cocsep(const uint32_t *table, uint64_t distr[static 21]) | 140 | getdistribution_cocsep( |
| 141 | const uint32_t table[static COCSEP_TABLESIZE], | ||
| 142 | uint64_t distr[static 21] | ||
| 143 | ) | ||
| 137 | { | 144 | { |
| 138 | size_t i; | 145 | size_t i; |
| 139 | 146 | ||
| @@ -144,19 +151,29 @@ getdistribution_cocsep(const uint32_t *table, uint64_t distr[static 21]) | |||
| 144 | } | 151 | } |
| 145 | 152 | ||
| 146 | STATIC_INLINE bool | 153 | STATIC_INLINE bool |
| 147 | gendata_cocsep_get_visited(const uint8_t *a, int64_t i) | 154 | gendata_cocsep_get_visited( |
| 155 | const uint8_t a[static COCSEP_VISITEDSIZE], | ||
| 156 | int64_t i | ||
| 157 | ) | ||
| 148 | { | 158 | { |
| 149 | return a[VISITED_IND(i)] & VISITED_MASK(i); | 159 | return a[VISITED_IND(i)] & VISITED_MASK(i); |
| 150 | } | 160 | } |
| 151 | 161 | ||
| 152 | STATIC_INLINE void | 162 | STATIC_INLINE void |
| 153 | gendata_cocsep_set_visited(uint8_t *a, int64_t i) | 163 | gendata_cocsep_set_visited( |
| 164 | uint8_t a[static COCSEP_VISITEDSIZE], | ||
| 165 | int64_t i | ||
| 166 | ) | ||
| 154 | { | 167 | { |
| 155 | a[VISITED_IND(i)] |= VISITED_MASK(i); | 168 | a[VISITED_IND(i)] |= VISITED_MASK(i); |
| 156 | } | 169 | } |
| 157 | 170 | ||
| 158 | STATIC_INLINE int8_t | 171 | STATIC_INLINE int8_t |
| 159 | get_h48_cdata(cube_t cube, const uint32_t *cocsepdata, uint32_t *cdata) | 172 | get_h48_cdata( |
| 173 | cube_t cube, | ||
| 174 | const uint32_t cocsepdata[static COCSEP_TABLESIZE], | ||
| 175 | uint32_t *cdata | ||
| 176 | ) | ||
| 160 | { | 177 | { |
| 161 | int64_t coord; | 178 | int64_t coord; |
| 162 | 179 | ||
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h index d887209..4bf5a84 100644 --- a/src/solvers/h48/gendata_eoesep.h +++ b/src/solvers/h48/gendata_eoesep.h | |||
| @@ -12,9 +12,11 @@ STATIC uint32_t gendata_eoesep_marksim(int64_t, uint8_t, | |||
| 12 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); | 12 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); |
| 13 | STATIC bool gendata_eoesep_next(cube_t, uint8_t, | 13 | STATIC bool gendata_eoesep_next(cube_t, uint8_t, |
| 14 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); | 14 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); |
| 15 | STATIC uint8_t get_eoesep_pval(const uint8_t *, int64_t); | 15 | STATIC uint8_t get_eoesep_pval( |
| 16 | const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t); | ||
| 16 | STATIC uint8_t get_eoesep_pval_cube(const void *, cube_t); | 17 | STATIC uint8_t get_eoesep_pval_cube(const void *, cube_t); |
| 17 | STATIC void set_eoesep_pval(uint8_t *, int64_t, uint8_t); | 18 | STATIC void set_eoesep_pval( |
| 19 | uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t, uint8_t); | ||
| 18 | 20 | ||
| 19 | STATIC int64_t | 21 | STATIC int64_t |
| 20 | coord_eoesep_sym(cube_t c, const uint32_t esep_classes[static ESEP_MAX]) | 22 | coord_eoesep_sym(cube_t c, const uint32_t esep_classes[static ESEP_MAX]) |
| @@ -247,7 +249,10 @@ gendata_eoesep_next( | |||
| 247 | } | 249 | } |
| 248 | 250 | ||
| 249 | STATIC uint8_t | 251 | STATIC uint8_t |
| 250 | get_eoesep_pval(const uint8_t *table, int64_t i) | 252 | get_eoesep_pval( |
| 253 | const uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], | ||
| 254 | int64_t i | ||
| 255 | ) | ||
| 251 | { | 256 | { |
| 252 | return (table[EOESEP_INDEX(i)] & EOESEP_MASK(i)) >> EOESEP_SHIFT(i); | 257 | return (table[EOESEP_INDEX(i)] & EOESEP_MASK(i)) >> EOESEP_SHIFT(i); |
| 253 | } | 258 | } |
| @@ -267,7 +272,11 @@ get_eoesep_pval_cube(const void *data, cube_t c) | |||
| 267 | } | 272 | } |
| 268 | 273 | ||
| 269 | STATIC void | 274 | STATIC void |
| 270 | set_eoesep_pval(uint8_t *table, int64_t i, uint8_t val) | 275 | set_eoesep_pval( |
| 276 | uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], | ||
| 277 | int64_t i, | ||
| 278 | uint8_t val | ||
| 279 | ) | ||
| 271 | { | 280 | { |
| 272 | table[EOESEP_INDEX(i)] = (table[EOESEP_INDEX(i)] & (~EOESEP_MASK(i))) | 281 | table[EOESEP_INDEX(i)] = (table[EOESEP_INDEX(i)] & (~EOESEP_MASK(i))) |
| 273 | | (val << EOESEP_SHIFT(i)); | 282 | | (val << EOESEP_SHIFT(i)); |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 2d9a9f7..959264d 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -1,17 +1,17 @@ | |||
| 1 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t *); | 1 | STATIC uint64_t genddfggta_h48short(gendata_h48short_arg_t [static 1]); |
| 2 | STATIC int64_t gendata_h48(gendata_h48_arg_t *); | 2 | STATIC int64_t gendata_h48(gendata_h48_arg_t [static 1]); |
| 3 | STATIC void gendata_h48h0k4(gendata_h48_arg_t *); | 3 | STATIC void gendata_h48h0k4(gendata_h48_arg_t [static 1]); |
| 4 | STATIC void gendata_h48k2(gendata_h48_arg_t *); | 4 | STATIC void gendata_h48k2(gendata_h48_arg_t [static 1]); |
| 5 | STATIC void gendata_h48k2_realcoord(gendata_h48_arg_t *); | ||
| 6 | 5 | ||
| 7 | STATIC void * gendata_h48h0k4_runthread(void *); | 6 | STATIC void * gendata_h48h0k4_runthread(void *); |
| 8 | STATIC void * gendata_h48k2_runthread(void *); | 7 | STATIC void * gendata_h48k2_runthread(void *); |
| 9 | 8 | ||
| 10 | STATIC_INLINE void gendata_h48_mark_atomic(gendata_h48_mark_t *); | 9 | STATIC_INLINE void gendata_h48_mark_atomic(gendata_h48_mark_t [static 1]); |
| 11 | STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t *); | 10 | STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t [static 1]); |
| 12 | STATIC_INLINE bool gendata_h48k2_dfs_stop(cube_t, int8_t, h48k2_dfs_arg_t *); | 11 | STATIC_INLINE bool gendata_h48k2_dfs_stop( |
| 13 | STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t *arg); | 12 | cube_t, int8_t, h48k2_dfs_arg_t [static 1]); |
| 14 | STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t *); | 13 | STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t [static 1]); |
| 14 | STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t [static 1]); | ||
| 15 | STATIC void getdistribution_h48(const uint8_t *, | 15 | STATIC void getdistribution_h48(const uint8_t *, |
| 16 | uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t); | 16 | uint64_t [static INFO_DISTRIBUTION_LEN], uint8_t, uint8_t); |
| 17 | 17 | ||
| @@ -28,7 +28,7 @@ STATIC_INLINE void set_h48_pval_atomic( | |||
| 28 | size_t gendata_h48_derive(uint8_t, const void *, void *); | 28 | size_t gendata_h48_derive(uint8_t, const void *, void *); |
| 29 | 29 | ||
| 30 | STATIC uint64_t | 30 | STATIC uint64_t |
| 31 | gendata_h48short(gendata_h48short_arg_t *arg) | 31 | gendata_h48short(gendata_h48short_arg_t arg[static 1]) |
| 32 | { | 32 | { |
| 33 | uint8_t i, m; | 33 | uint8_t i, m; |
| 34 | int64_t coord; | 34 | int64_t coord; |
| @@ -62,7 +62,7 @@ gendata_h48short(gendata_h48short_arg_t *arg) | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | STATIC int64_t | 64 | STATIC int64_t |
| 65 | gendata_h48(gendata_h48_arg_t *arg) | 65 | gendata_h48(gendata_h48_arg_t arg[static 1]) |
| 66 | { | 66 | { |
| 67 | uint64_t size, cocsepsize, h48size, fallbacksize, fallback2size, of; | 67 | uint64_t size, cocsepsize, h48size, fallbacksize, fallback2size, of; |
| 68 | long long r; | 68 | long long r; |
| @@ -70,11 +70,6 @@ gendata_h48(gendata_h48_arg_t *arg) | |||
| 70 | tableinfo_t cocsepinfo, h48info, fallbackinfo; | 70 | tableinfo_t cocsepinfo, h48info, fallbackinfo; |
| 71 | gendata_h48_arg_t arg_h0k4; | 71 | gendata_h48_arg_t arg_h0k4; |
| 72 | 72 | ||
| 73 | if (arg == NULL) { | ||
| 74 | LOG("Error computing H48 data: arg is NULL.\n"); | ||
| 75 | return NISSY_ERROR_UNKNOWN; | ||
| 76 | } | ||
| 77 | |||
| 78 | cocsepsize = COCSEP_FULLSIZE; | 73 | cocsepsize = COCSEP_FULLSIZE; |
| 79 | h48size = INFOSIZE + H48_TABLESIZE(arg->h, arg->k); | 74 | h48size = INFOSIZE + H48_TABLESIZE(arg->h, arg->k); |
| 80 | fallbacksize = arg->k == 2 ? INFOSIZE + H48_TABLESIZE(0, 4) : 0; | 75 | fallbacksize = arg->k == 2 ? INFOSIZE + H48_TABLESIZE(0, 4) : 0; |
| @@ -107,8 +102,6 @@ gendata_h48(gendata_h48_arg_t *arg) | |||
| 107 | 102 | ||
| 108 | if (arg->h == 0 && arg->k == 4) { | 103 | if (arg->h == 0 && arg->k == 4) { |
| 109 | gendata_h48h0k4(arg); | 104 | gendata_h48h0k4(arg); |
| 110 | } else if ((arg->h == 0 || arg->h == 11) && arg->k == 2) { | ||
| 111 | gendata_h48k2_realcoord(arg); | ||
| 112 | } else if (arg->k == 2) { | 105 | } else if (arg->k == 2) { |
| 113 | gendata_h48k2(arg); | 106 | gendata_h48k2(arg); |
| 114 | } else { | 107 | } else { |
| @@ -189,7 +182,7 @@ gendata_h48(gendata_h48_arg_t *arg) | |||
| 189 | } | 182 | } |
| 190 | 183 | ||
| 191 | STATIC void | 184 | STATIC void |
| 192 | gendata_h48h0k4(gendata_h48_arg_t *arg) | 185 | gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) |
| 193 | { | 186 | { |
| 194 | _Atomic uint8_t *table; | 187 | _Atomic uint8_t *table; |
| 195 | uint8_t val; | 188 | uint8_t val; |
| @@ -325,7 +318,7 @@ gendata_h48h0k4_runthread(void *arg) | |||
| 325 | } | 318 | } |
| 326 | 319 | ||
| 327 | STATIC void | 320 | STATIC void |
| 328 | gendata_h48k2(gendata_h48_arg_t *arg) | 321 | gendata_h48k2(gendata_h48_arg_t arg[static 1]) |
| 329 | { | 322 | { |
| 330 | static const uint8_t shortdepth = 8; | 323 | static const uint8_t shortdepth = 8; |
| 331 | static const uint64_t capacity = 10000019; | 324 | static const uint64_t capacity = 10000019; |
| @@ -483,7 +476,7 @@ gendata_h48k2_runthread(void *arg) | |||
| 483 | } | 476 | } |
| 484 | 477 | ||
| 485 | STATIC void | 478 | STATIC void |
| 486 | gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) | 479 | gendata_h48k2_dfs(h48k2_dfs_arg_t arg[static 1]) |
| 487 | { | 480 | { |
| 488 | int8_t d; | 481 | int8_t d; |
| 489 | uint8_t m[4]; | 482 | uint8_t m[4]; |
| @@ -562,7 +555,7 @@ gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) | |||
| 562 | } | 555 | } |
| 563 | 556 | ||
| 564 | STATIC_INLINE void | 557 | STATIC_INLINE void |
| 565 | gendata_h48_mark_atomic(gendata_h48_mark_t *arg) | 558 | gendata_h48_mark_atomic(gendata_h48_mark_t arg[static 1]) |
| 566 | { | 559 | { |
| 567 | uint8_t oldval, newval; | 560 | uint8_t oldval, newval; |
| 568 | int64_t coord, mutex; | 561 | int64_t coord, mutex; |
| @@ -582,7 +575,7 @@ gendata_h48_mark_atomic(gendata_h48_mark_t *arg) | |||
| 582 | } | 575 | } |
| 583 | 576 | ||
| 584 | STATIC_INLINE void | 577 | STATIC_INLINE void |
| 585 | gendata_h48_mark(gendata_h48_mark_t *arg) | 578 | gendata_h48_mark(gendata_h48_mark_t arg[static 1]) |
| 586 | { | 579 | { |
| 587 | uint8_t oldval, newval; | 580 | uint8_t oldval, newval; |
| 588 | int64_t coord, mutex; | 581 | int64_t coord, mutex; |
| @@ -599,7 +592,7 @@ gendata_h48_mark(gendata_h48_mark_t *arg) | |||
| 599 | } | 592 | } |
| 600 | 593 | ||
| 601 | STATIC_INLINE bool | 594 | STATIC_INLINE bool |
| 602 | gendata_h48k2_dfs_stop(cube_t cube, int8_t depth, h48k2_dfs_arg_t *arg) | 595 | gendata_h48k2_dfs_stop(cube_t cube, int8_t d, h48k2_dfs_arg_t arg[static 1]) |
| 603 | { | 596 | { |
| 604 | uint64_t val; | 597 | uint64_t val; |
| 605 | int64_t coord, mutex; | 598 | int64_t coord, mutex; |
| @@ -613,7 +606,7 @@ gendata_h48k2_dfs_stop(cube_t cube, int8_t depth, h48k2_dfs_arg_t *arg) | |||
| 613 | pthread_mutex_lock(arg->table_mutex[mutex]); | 606 | pthread_mutex_lock(arg->table_mutex[mutex]); |
| 614 | oldval = get_h48_pval(arg->table, coord, arg->k); | 607 | oldval = get_h48_pval(arg->table, coord, arg->k); |
| 615 | pthread_mutex_unlock(arg->table_mutex[mutex]); | 608 | pthread_mutex_unlock(arg->table_mutex[mutex]); |
| 616 | return oldval <= depth; | 609 | return oldval <= d; |
| 617 | } else { | 610 | } else { |
| 618 | /* With 0 < k < 11 we do not have a "real coordinate". | 611 | /* With 0 < k < 11 we do not have a "real coordinate". |
| 619 | The best we can do is checking if we backtracked to | 612 | The best we can do is checking if we backtracked to |
| @@ -624,22 +617,8 @@ gendata_h48k2_dfs_stop(cube_t cube, int8_t depth, h48k2_dfs_arg_t *arg) | |||
| 624 | } | 617 | } |
| 625 | } | 618 | } |
| 626 | 619 | ||
| 627 | STATIC void | ||
| 628 | gendata_h48k2_realcoord(gendata_h48_arg_t *arg) | ||
| 629 | { | ||
| 630 | /* TODO */ | ||
| 631 | gendata_h48k2(arg); | ||
| 632 | } | ||
| 633 | |||
| 634 | STATIC void * | ||
| 635 | gendata_h48k2_realcoord_runthread(void *arg) | ||
| 636 | { | ||
| 637 | /* TODO */ | ||
| 638 | return NULL; | ||
| 639 | } | ||
| 640 | |||
| 641 | STATIC tableinfo_t | 620 | STATIC tableinfo_t |
| 642 | makeinfo_h48k2(gendata_h48_arg_t *arg) | 621 | makeinfo_h48k2(gendata_h48_arg_t arg[static 1]) |
| 643 | { | 622 | { |
| 644 | tableinfo_t info; | 623 | tableinfo_t info; |
| 645 | 624 | ||
diff --git a/src/solvers/h48/gendata_types_macros.h b/src/solvers/h48/gendata_types_macros.h index ec6576a..11940d8 100644 --- a/src/solvers/h48/gendata_types_macros.h +++ b/src/solvers/h48/gendata_types_macros.h | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | /* | 33 | /* |
| 34 | TODO: This loop over similar h48 coordinates can be improved by only | 34 | TODO: This loop over similar h48 coordinates can be improved by only |
| 35 | transforming edges, but we need to compose transformations (i.e. conjugate | 35 | transforming edges, but we need to compose transformations (i.e. conjugate |
| 36 | _t by _ttrep). | 36 | VAR_T by VAR_TTREP). |
| 37 | */ | 37 | */ |
| 38 | #define FOREACH_H48SIM(ARG_CUBE, ARG_COCSEPDATA, ARG_SELFSIM, ARG_ACTION) \ | 38 | #define FOREACH_H48SIM(ARG_CUBE, ARG_COCSEPDATA, ARG_SELFSIM, ARG_ACTION) \ |
| 39 | int64_t VAR_COCSEP = coord_cocsep(ARG_CUBE); \ | 39 | int64_t VAR_COCSEP = coord_cocsep(ARG_CUBE); \ |
diff --git a/src/solvers/h48/h48.h b/src/solvers/h48/h48.h index d5a67ef..0cfa773 100644 --- a/src/solvers/h48/h48.h +++ b/src/solvers/h48/h48.h | |||
| @@ -1,6 +1,8 @@ | |||
| 1 | #include "coordinate_types_macros.h" | ||
| 2 | #include "map_types_macros.h" | ||
| 3 | #include "gendata_types_macros.h" | ||
| 1 | #include "coordinate.h" | 4 | #include "coordinate.h" |
| 2 | #include "map.h" | 5 | #include "map.h" |
| 3 | #include "gendata_types_macros.h" | ||
| 4 | #include "gendata_cocsep.h" | 6 | #include "gendata_cocsep.h" |
| 5 | #include "gendata_eoesep.h" | 7 | #include "gendata_eoesep.h" |
| 6 | #include "gendata_h48.h" | 8 | #include "gendata_h48.h" |
diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h index e6903ce..7718794 100644 --- a/src/solvers/h48/map.h +++ b/src/solvers/h48/map.h | |||
| @@ -1,16 +1,13 @@ | |||
| 1 | /* Type definitions and macros are in a separate file for easier testing */ | 1 | STATIC void h48map_create(h48map_t [static 1], uint64_t, uint64_t); |
| 2 | #include "map_types_macros.h" | 2 | STATIC void h48map_clear(h48map_t [static 1]); |
| 3 | 3 | STATIC void h48map_destroy(h48map_t [static 1]); | |
| 4 | STATIC void h48map_create(h48map_t *, uint64_t, uint64_t); | 4 | STATIC uint64_t h48map_lookup(h48map_t [static 1], uint64_t); |
| 5 | STATIC void h48map_clear(h48map_t *); | 5 | STATIC void h48map_insertmin(h48map_t [static 1], uint64_t, uint64_t); |
| 6 | STATIC void h48map_destroy(h48map_t *); | 6 | STATIC uint64_t h48map_value(h48map_t [static 1], uint64_t); |
| 7 | STATIC uint64_t h48map_lookup(h48map_t *, uint64_t); | 7 | STATIC kvpair_t h48map_nextkvpair(h48map_t [static 1], uint64_t [static 1]); |
| 8 | STATIC void h48map_insertmin(h48map_t *, uint64_t, uint64_t); | ||
| 9 | STATIC uint64_t h48map_value(h48map_t *, uint64_t); | ||
| 10 | STATIC kvpair_t h48map_nextkvpair(h48map_t *, uint64_t *); | ||
| 11 | 8 | ||
| 12 | STATIC void | 9 | STATIC void |
| 13 | h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer) | 10 | h48map_create(h48map_t map[static 1], uint64_t capacity, uint64_t randomizer) |
| 14 | { | 11 | { |
| 15 | map->capacity = capacity; | 12 | map->capacity = capacity; |
| 16 | map->randomizer = randomizer; | 13 | map->randomizer = randomizer; |
| @@ -20,20 +17,20 @@ h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer) | |||
| 20 | } | 17 | } |
| 21 | 18 | ||
| 22 | STATIC void | 19 | STATIC void |
| 23 | h48map_clear(h48map_t *map) | 20 | h48map_clear(h48map_t map[static 1]) |
| 24 | { | 21 | { |
| 25 | memset(map->table, 0xFF, map->capacity * sizeof(uint64_t)); | 22 | memset(map->table, 0xFF, map->capacity * sizeof(uint64_t)); |
| 26 | map->n = 0; | 23 | map->n = 0; |
| 27 | } | 24 | } |
| 28 | 25 | ||
| 29 | STATIC void | 26 | STATIC void |
| 30 | h48map_destroy(h48map_t *map) | 27 | h48map_destroy(h48map_t map[static 1]) |
| 31 | { | 28 | { |
| 32 | free(map->table); | 29 | free(map->table); |
| 33 | } | 30 | } |
| 34 | 31 | ||
| 35 | STATIC_INLINE uint64_t | 32 | STATIC_INLINE uint64_t |
| 36 | h48map_lookup(h48map_t *map, uint64_t x) | 33 | h48map_lookup(h48map_t map[static 1], uint64_t x) |
| 37 | { | 34 | { |
| 38 | uint64_t hash, i; | 35 | uint64_t hash, i; |
| 39 | 36 | ||
| @@ -47,7 +44,7 @@ h48map_lookup(h48map_t *map, uint64_t x) | |||
| 47 | } | 44 | } |
| 48 | 45 | ||
| 49 | STATIC_INLINE void | 46 | STATIC_INLINE void |
| 50 | h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val) | 47 | h48map_insertmin(h48map_t map[static 1], uint64_t key, uint64_t val) |
| 51 | { | 48 | { |
| 52 | uint64_t i, oldval, min; | 49 | uint64_t i, oldval, min; |
| 53 | 50 | ||
| @@ -60,13 +57,13 @@ h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val) | |||
| 60 | } | 57 | } |
| 61 | 58 | ||
| 62 | STATIC_INLINE uint64_t | 59 | STATIC_INLINE uint64_t |
| 63 | h48map_value(h48map_t *map, uint64_t key) | 60 | h48map_value(h48map_t map[static 1], uint64_t key) |
| 64 | { | 61 | { |
| 65 | return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT; | 62 | return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT; |
| 66 | } | 63 | } |
| 67 | 64 | ||
| 68 | STATIC kvpair_t | 65 | STATIC kvpair_t |
| 69 | h48map_nextkvpair(h48map_t *map, uint64_t *p) | 66 | h48map_nextkvpair(h48map_t map[static 1], uint64_t p[static 1]) |
| 70 | { | 67 | { |
| 71 | kvpair_t kv; | 68 | kvpair_t kv; |
| 72 | uint64_t pair; | 69 | uint64_t pair; |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index dbd15bb..dcec5a4 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -46,18 +46,18 @@ typedef struct { | |||
| 46 | int8_t *shortest_sol; | 46 | int8_t *shortest_sol; |
| 47 | } dfsarg_solve_h48_maketasks_t; | 47 | } dfsarg_solve_h48_maketasks_t; |
| 48 | 48 | ||
| 49 | STATIC_INLINE bool solve_h48_stop(dfsarg_solve_h48_t *); | 49 | STATIC_INLINE bool solve_h48_stop(dfsarg_solve_h48_t [static 1]); |
| 50 | STATIC int64_t solve_h48_maketasks( | 50 | STATIC int64_t solve_h48_maketasks( |
| 51 | dfsarg_solve_h48_t *, dfsarg_solve_h48_maketasks_t *, | 51 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], |
| 52 | solve_h48_task_t [static STARTING_CUBES], int *); | 52 | solve_h48_task_t [static STARTING_CUBES], int [static 1]); |
| 53 | STATIC void *solve_h48_runthread(void *); | 53 | STATIC void *solve_h48_runthread(void *); |
| 54 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t *); | 54 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); |
| 55 | STATIC int64_t solve_h48(cube_t, int8_t, int8_t, uint64_t, int8_t, int8_t, | 55 | STATIC int64_t solve_h48(cube_t, int8_t, int8_t, uint64_t, int8_t, int8_t, |
| 56 | uint64_t, const void *, size_t n, char [n], | 56 | uint64_t, const void *, size_t n, char [n], |
| 57 | long long [static NISSY_SIZE_SOLVE_STATS]); | 57 | long long [static NISSY_SIZE_SOLVE_STATS]); |
| 58 | 58 | ||
| 59 | STATIC_INLINE bool | 59 | STATIC_INLINE bool |
| 60 | solve_h48_stop(dfsarg_solve_h48_t *arg) | 60 | solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) |
| 61 | { | 61 | { |
| 62 | uint32_t data, data_inv; | 62 | uint32_t data, data_inv; |
| 63 | int64_t coord; | 63 | int64_t coord; |
| @@ -145,7 +145,7 @@ solve_h48_stop(dfsarg_solve_h48_t *arg) | |||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | STATIC int64_t | 147 | STATIC int64_t |
| 148 | solve_h48_dfs(dfsarg_solve_h48_t *arg) | 148 | solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) |
| 149 | { | 149 | { |
| 150 | int64_t ret, n; | 150 | int64_t ret, n; |
| 151 | uint8_t m, nm, lbn, lbi; | 151 | uint8_t m, nm, lbn, lbi; |
| @@ -261,10 +261,10 @@ solve_h48_runthread(void *arg) | |||
| 261 | 261 | ||
| 262 | STATIC int64_t | 262 | STATIC int64_t |
| 263 | solve_h48_maketasks( | 263 | solve_h48_maketasks( |
| 264 | dfsarg_solve_h48_t *solve_arg, | 264 | dfsarg_solve_h48_t solve_arg[static 1], |
| 265 | dfsarg_solve_h48_maketasks_t *maketasks_arg, | 265 | dfsarg_solve_h48_maketasks_t maketasks_arg[static 1], |
| 266 | solve_h48_task_t tasks[static STARTING_CUBES], | 266 | solve_h48_task_t tasks[static STARTING_CUBES], |
| 267 | int *ntasks | 267 | int ntasks[static 1] |
| 268 | ) | 268 | ) |
| 269 | { | 269 | { |
| 270 | int r; | 270 | int r; |
