diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 15:55:33 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 15:55:33 +0200 |
| commit | fc41f7917531693680b5baf71ffe38c47333fe84 (patch) | |
| tree | a6e62232e05e7779034c5f9d1bf743b6f1c198e3 /src/solvers/h48 | |
| parent | fe534f1497da6447153064d7bba00243000f803b (diff) | |
| download | nissy-core-fc41f7917531693680b5baf71ffe38c47333fe84.tar.gz nissy-core-fc41f7917531693680b5baf71ffe38c47333fe84.zip | |
Make the project build with Microsoft's broken C compiler.
MSVC is not fully C11-compliant, even when compiling with /std:c11.
Some changes were needed to make the codebase compatible. Notably, the
notation a[static N] and a[n] for function parameters of array type is
not supported, so that had to be hidden behind a macro. Atomic types
are also an experimental feature, apparently, but at least they work
with the correct compiler flag.
One thing that MSVC does well, however, is warning on integer conversions
on /W4 level. I am not sure if Clang and GCC have something similar,
so I took this chance to fix some of these.
Diffstat (limited to 'src/solvers/h48')
| -rw-r--r-- | src/solvers/h48/coordinate.h | 8 | ||||
| -rw-r--r-- | src/solvers/h48/distribution_h48.h | 6 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_cocsep.h | 21 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_eoesep.h | 62 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 36 | ||||
| -rw-r--r-- | src/solvers/h48/map.h | 28 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 68 | ||||
| -rw-r--r-- | src/solvers/h48/utils.h | 10 |
8 files changed, 120 insertions, 119 deletions
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h index a7f0087..695efc3 100644 --- a/src/solvers/h48/coordinate.h +++ b/src/solvers/h48/coordinate.h | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | STATIC_INLINE uint64_t coord_h48( | 1 | STATIC_INLINE uint64_t coord_h48( |
| 2 | cube_t, const uint32_t [static COCSEP_TABLESIZE], uint8_t); | 2 | cube_t, const uint32_t [SIZE(COCSEP_TABLESIZE)], uint8_t); |
| 3 | STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); | 3 | STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); |
| 4 | STATIC_INLINE cube_t invcoord_h48( | 4 | STATIC_INLINE cube_t invcoord_h48( |
| 5 | uint64_t, const cube_t [static COCSEP_CLASSES], uint8_t); | 5 | uint64_t, const cube_t [SIZE(COCSEP_CLASSES)], uint8_t); |
| 6 | 6 | ||
| 7 | STATIC_INLINE uint64_t | 7 | STATIC_INLINE uint64_t |
| 8 | coord_h48( | 8 | coord_h48( |
| 9 | cube_t c, | 9 | cube_t c, |
| 10 | const uint32_t cocsepdata[static COCSEP_TABLESIZE], | 10 | const uint32_t cocsepdata[SIZE(COCSEP_TABLESIZE)], |
| 11 | uint8_t h | 11 | uint8_t h |
| 12 | ) | 12 | ) |
| 13 | { | 13 | { |
| @@ -47,7 +47,7 @@ returned cube is a transformed cube of one that gives the correct value. | |||
| 47 | STATIC_INLINE cube_t | 47 | STATIC_INLINE cube_t |
| 48 | invcoord_h48( | 48 | invcoord_h48( |
| 49 | uint64_t i, | 49 | uint64_t i, |
| 50 | const cube_t crep[static COCSEP_CLASSES], | 50 | const cube_t crep[SIZE(COCSEP_CLASSES)], |
| 51 | uint8_t h | 51 | uint8_t h |
| 52 | ) | 52 | ) |
| 53 | { | 53 | { |
diff --git a/src/solvers/h48/distribution_h48.h b/src/solvers/h48/distribution_h48.h index 80c946e..2cb50aa 100644 --- a/src/solvers/h48/distribution_h48.h +++ b/src/solvers/h48/distribution_h48.h | |||
| @@ -6,7 +6,7 @@ to have some duplication than to make these functions needlessly generic. | |||
| 6 | 6 | ||
| 7 | STATIC wrapthread_return_t getdistribution_h48_runthread(void *); | 7 | STATIC wrapthread_return_t getdistribution_h48_runthread(void *); |
| 8 | STATIC void getdistribution_h48(const unsigned char *, | 8 | STATIC void getdistribution_h48(const unsigned char *, |
| 9 | uint64_t [static INFO_DISTRIBUTION_LEN], const tableinfo_t [static 1]); | 9 | uint64_t [SIZE(INFO_DISTRIBUTION_LEN)], const tableinfo_t [NON_NULL]); |
| 10 | 10 | ||
| 11 | STATIC wrapthread_return_t | 11 | STATIC wrapthread_return_t |
| 12 | getdistribution_h48_runthread(void *arg) | 12 | getdistribution_h48_runthread(void *arg) |
| @@ -39,8 +39,8 @@ getdistribution_h48_runthread(void *arg) | |||
| 39 | STATIC void | 39 | STATIC void |
| 40 | getdistribution_h48( | 40 | getdistribution_h48( |
| 41 | const unsigned char *table, | 41 | const unsigned char *table, |
| 42 | uint64_t distr[static INFO_DISTRIBUTION_LEN], | 42 | uint64_t distr[SIZE(INFO_DISTRIBUTION_LEN)], |
| 43 | const tableinfo_t info[static 1] | 43 | const tableinfo_t info[NON_NULL] |
| 44 | ) { | 44 | ) { |
| 45 | getdistribution_data_t targ[THREADS]; | 45 | getdistribution_data_t targ[THREADS]; |
| 46 | wrapthread_define_var_thread_t(thread[THREADS]); | 46 | wrapthread_define_var_thread_t(thread[THREADS]); |
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index db7ac95..f83207b 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); | 1 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); | 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [NON_NULL]); |
| 3 | 3 | ||
| 4 | STATIC_INLINE bool gendata_cocsep_get_visited( | 4 | STATIC_INLINE bool gendata_cocsep_get_visited( |
| 5 | const uint8_t [static COCSEP_VISITEDSIZE], uint64_t); | 5 | const uint8_t [SIZE(COCSEP_VISITEDSIZE)], uint64_t); |
| 6 | STATIC_INLINE void gendata_cocsep_set_visited( | 6 | STATIC_INLINE void gendata_cocsep_set_visited( |
| 7 | uint8_t [static COCSEP_VISITEDSIZE], uint64_t); | 7 | uint8_t [SIZE(COCSEP_VISITEDSIZE)], uint64_t); |
| 8 | 8 | ||
| 9 | STATIC_INLINE int8_t get_h48_cdata( | 9 | STATIC_INLINE int8_t get_h48_cdata( |
| 10 | cube_t, const uint32_t [static COCSEP_TABLESIZE], uint32_t *); | 10 | cube_t, const uint32_t [SIZE(COCSEP_TABLESIZE)], uint32_t *); |
| 11 | 11 | ||
| 12 | STATIC size_t | 12 | STATIC size_t |
| 13 | gendata_cocsep( | 13 | gendata_cocsep( |
| @@ -79,11 +79,10 @@ gendata_cocsep_return_size: | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | STATIC uint32_t | 81 | STATIC uint32_t |
| 82 | gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) | 82 | gendata_cocsep_dfs(cocsep_dfs_arg_t arg[NON_NULL]) |
| 83 | { | 83 | { |
| 84 | uint8_t m; | 84 | uint8_t m, t; |
| 85 | uint32_t cc, class, ttrep, depth, olddepth, tinv; | 85 | uint32_t cc, class, ttrep, depth, olddepth, tinv; |
| 86 | uint64_t t; | ||
| 87 | uint64_t i, j; | 86 | uint64_t i, j; |
| 88 | cube_t d; | 87 | cube_t d; |
| 89 | cocsep_dfs_arg_t nextarg; | 88 | cocsep_dfs_arg_t nextarg; |
| @@ -105,7 +104,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) | |||
| 105 | d = transform_corners(arg->cube, t); | 104 | d = transform_corners(arg->cube, t); |
| 106 | j = coord_cocsep(d); | 105 | j = coord_cocsep(d); |
| 107 | if (i == j && arg->selfsim != NULL) | 106 | if (i == j && arg->selfsim != NULL) |
| 108 | arg->selfsim[*arg->n] |= UINT64_C(1) << t; | 107 | arg->selfsim[*arg->n] |= UINT64_C(1) << (uint64_t)t; |
| 109 | if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF)) | 108 | if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF)) |
| 110 | continue; | 109 | continue; |
| 111 | gendata_cocsep_set_visited(arg->visited, j); | 110 | gendata_cocsep_set_visited(arg->visited, j); |
| @@ -135,7 +134,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) | |||
| 135 | 134 | ||
| 136 | STATIC_INLINE bool | 135 | STATIC_INLINE bool |
| 137 | gendata_cocsep_get_visited( | 136 | gendata_cocsep_get_visited( |
| 138 | const uint8_t a[static COCSEP_VISITEDSIZE], | 137 | const uint8_t a[SIZE(COCSEP_VISITEDSIZE)], |
| 139 | uint64_t i | 138 | uint64_t i |
| 140 | ) | 139 | ) |
| 141 | { | 140 | { |
| @@ -144,7 +143,7 @@ gendata_cocsep_get_visited( | |||
| 144 | 143 | ||
| 145 | STATIC_INLINE void | 144 | STATIC_INLINE void |
| 146 | gendata_cocsep_set_visited( | 145 | gendata_cocsep_set_visited( |
| 147 | uint8_t a[static COCSEP_VISITEDSIZE], | 146 | uint8_t a[SIZE(COCSEP_VISITEDSIZE)], |
| 148 | uint64_t i | 147 | uint64_t i |
| 149 | ) | 148 | ) |
| 150 | { | 149 | { |
| @@ -154,7 +153,7 @@ gendata_cocsep_set_visited( | |||
| 154 | STATIC_INLINE int8_t | 153 | STATIC_INLINE int8_t |
| 155 | get_h48_cdata( | 154 | get_h48_cdata( |
| 156 | cube_t cube, | 155 | cube_t cube, |
| 157 | const uint32_t cocsepdata[static COCSEP_TABLESIZE], | 156 | const uint32_t cocsepdata[SIZE(COCSEP_TABLESIZE)], |
| 158 | uint32_t *cdata | 157 | uint32_t *cdata |
| 159 | ) | 158 | ) |
| 160 | { | 159 | { |
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h index e9a2794..81bbd43 100644 --- a/src/solvers/h48/gendata_eoesep.h +++ b/src/solvers/h48/gendata_eoesep.h | |||
| @@ -1,25 +1,25 @@ | |||
| 1 | STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); | 1 | STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [SIZE(ESEP_MAX)]); |
| 2 | STATIC size_t gendata_esep_classes( | 2 | STATIC size_t gendata_esep_classes( |
| 3 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); | 3 | uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); |
| 4 | STATIC size_t gendata_eoesep(unsigned char *, uint8_t); | 4 | STATIC size_t gendata_eoesep(unsigned char *, uint8_t); |
| 5 | STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [static EOESEP_BUF], | 5 | STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [SIZE(EOESEP_BUF)], |
| 6 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); | 6 | uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); |
| 7 | STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF], | 7 | STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [SIZE(EOESEP_BUF)], |
| 8 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); | 8 | uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); |
| 9 | STATIC uint32_t gendata_eoesep_fromdone(uint8_t, uint8_t [static EOESEP_BUF], | 9 | STATIC uint32_t gendata_eoesep_fromdone(uint8_t, uint8_t [SIZE(EOESEP_BUF)], |
| 10 | uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); | 10 | uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]); |
| 11 | STATIC uint32_t gendata_eoesep_marksim(uint64_t, uint8_t, | 11 | STATIC uint32_t gendata_eoesep_marksim(uint64_t, uint8_t, |
| 12 | uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); | 12 | uint8_t [SIZE(EOESEP_BUF)], uint32_t [SIZE(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 [SIZE(EOESEP_BUF)], uint32_t [SIZE(ESEP_MAX)]); |
| 15 | STATIC uint8_t get_eoesep_pval( | 15 | STATIC uint8_t get_eoesep_pval( |
| 16 | const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], uint64_t); | 16 | const uint8_t [SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))], uint64_t); |
| 17 | STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t); | 17 | STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t); |
| 18 | STATIC void set_eoesep_pval( | 18 | STATIC void set_eoesep_pval( |
| 19 | uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], uint64_t, uint8_t); | 19 | uint8_t [SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))], uint64_t, uint8_t); |
| 20 | 20 | ||
| 21 | STATIC uint64_t | 21 | STATIC uint64_t |
| 22 | 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[SIZE(ESEP_MAX)]) |
| 23 | { | 23 | { |
| 24 | uint8_t ttrep; | 24 | uint8_t ttrep; |
| 25 | uint32_t edata, class; | 25 | uint32_t edata, class; |
| @@ -36,8 +36,8 @@ coord_eoesep_sym(cube_t c, const uint32_t esep_classes[static ESEP_MAX]) | |||
| 36 | 36 | ||
| 37 | STATIC size_t | 37 | STATIC size_t |
| 38 | gendata_esep_classes( | 38 | gendata_esep_classes( |
| 39 | uint32_t esep_classes[static ESEP_MAX], | 39 | uint32_t esep_classes[SIZE(ESEP_MAX)], |
| 40 | uint16_t rep[static ESEP_CLASSES] | 40 | uint16_t rep[SIZE(ESEP_CLASSES)] |
| 41 | ) | 41 | ) |
| 42 | { | 42 | { |
| 43 | bool visited[ESEP_MAX]; | 43 | bool visited[ESEP_MAX]; |
| @@ -59,7 +59,7 @@ gendata_esep_classes( | |||
| 59 | esep_classes[j] = cl | ti; | 59 | esep_classes[j] = cl | ti; |
| 60 | visited[j] = true; | 60 | visited[j] = true; |
| 61 | } | 61 | } |
| 62 | rep[class] = i; | 62 | rep[class] = (uint16_t)i; |
| 63 | class++; | 63 | class++; |
| 64 | } | 64 | } |
| 65 | 65 | ||
| @@ -121,8 +121,8 @@ STATIC uint32_t | |||
| 121 | gendata_eoesep_bfs( | 121 | gendata_eoesep_bfs( |
| 122 | uint8_t d, | 122 | uint8_t d, |
| 123 | uint8_t buf8[EOESEP_BUF], | 123 | uint8_t buf8[EOESEP_BUF], |
| 124 | uint32_t esep_classes[static ESEP_MAX], | 124 | uint32_t esep_classes[SIZE(ESEP_MAX)], |
| 125 | uint16_t rep[static ESEP_CLASSES] | 125 | uint16_t rep[SIZE(ESEP_CLASSES)] |
| 126 | ) | 126 | ) |
| 127 | { | 127 | { |
| 128 | if (d < 9) | 128 | if (d < 9) |
| @@ -135,12 +135,13 @@ STATIC uint32_t | |||
| 135 | gendata_eoesep_fromdone( | 135 | gendata_eoesep_fromdone( |
| 136 | uint8_t d, | 136 | uint8_t d, |
| 137 | uint8_t buf8[EOESEP_BUF], | 137 | uint8_t buf8[EOESEP_BUF], |
| 138 | uint32_t esep_classes[static ESEP_MAX], | 138 | uint32_t esep_classes[SIZE(ESEP_MAX)], |
| 139 | uint16_t rep[static ESEP_CLASSES] | 139 | uint16_t rep[SIZE(ESEP_CLASSES)] |
| 140 | ) | 140 | ) |
| 141 | { | 141 | { |
| 142 | uint8_t pval; | 142 | uint8_t pval; |
| 143 | uint64_t i, esep, eo, coord, done; | 143 | uint32_t done; |
| 144 | uint64_t i, esep, eo, coord; | ||
| 144 | 145 | ||
| 145 | done = 0; | 146 | done = 0; |
| 146 | for (i = 0; i < ESEP_CLASSES; i++) { | 147 | for (i = 0; i < ESEP_CLASSES; i++) { |
| @@ -164,12 +165,13 @@ STATIC uint32_t | |||
| 164 | gendata_eoesep_fromnew( | 165 | gendata_eoesep_fromnew( |
| 165 | uint8_t d, | 166 | uint8_t d, |
| 166 | uint8_t buf8[EOESEP_BUF], | 167 | uint8_t buf8[EOESEP_BUF], |
| 167 | uint32_t esep_classes[static ESEP_MAX], | 168 | uint32_t esep_classes[SIZE(ESEP_MAX)], |
| 168 | uint16_t rep[static ESEP_CLASSES] | 169 | uint16_t rep[SIZE(ESEP_CLASSES)] |
| 169 | ) | 170 | ) |
| 170 | { | 171 | { |
| 171 | uint8_t pval; | 172 | uint8_t pval; |
| 172 | uint64_t i, esep, eo, coord, done; | 173 | uint32_t done; |
| 174 | uint64_t i, esep, eo, coord; | ||
| 173 | cube_t c; | 175 | cube_t c; |
| 174 | 176 | ||
| 175 | done = 0; | 177 | done = 0; |
| @@ -196,8 +198,8 @@ STATIC uint32_t | |||
| 196 | gendata_eoesep_marksim( | 198 | gendata_eoesep_marksim( |
| 197 | uint64_t i, | 199 | uint64_t i, |
| 198 | uint8_t d, | 200 | uint8_t d, |
| 199 | uint8_t buf8[static EOESEP_BUF], | 201 | uint8_t buf8[SIZE(EOESEP_BUF)], |
| 200 | uint32_t esep_classes[static ESEP_MAX] | 202 | uint32_t esep_classes[SIZE(ESEP_MAX)] |
| 201 | ) | 203 | ) |
| 202 | { | 204 | { |
| 203 | uint8_t t, m, pval; | 205 | uint8_t t, m, pval; |
| @@ -227,8 +229,8 @@ STATIC bool | |||
| 227 | gendata_eoesep_next( | 229 | gendata_eoesep_next( |
| 228 | cube_t c, | 230 | cube_t c, |
| 229 | uint8_t d, | 231 | uint8_t d, |
| 230 | uint8_t buf8[static EOESEP_BUF], | 232 | uint8_t buf8[SIZE(EOESEP_BUF)], |
| 231 | uint32_t esep_classes[static ESEP_MAX] | 233 | uint32_t esep_classes[SIZE(ESEP_MAX)] |
| 232 | ) | 234 | ) |
| 233 | { | 235 | { |
| 234 | uint8_t m, t, pval; | 236 | uint8_t m, t, pval; |
| @@ -251,7 +253,7 @@ gendata_eoesep_next( | |||
| 251 | 253 | ||
| 252 | STATIC uint8_t | 254 | STATIC uint8_t |
| 253 | get_eoesep_pval( | 255 | get_eoesep_pval( |
| 254 | const uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], | 256 | const uint8_t table[SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))], |
| 255 | uint64_t i | 257 | uint64_t i |
| 256 | ) | 258 | ) |
| 257 | { | 259 | { |
| @@ -270,7 +272,7 @@ get_eoesep_pval_cube(const unsigned char *data, cube_t c) | |||
| 270 | 272 | ||
| 271 | STATIC void | 273 | STATIC void |
| 272 | set_eoesep_pval( | 274 | set_eoesep_pval( |
| 273 | uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], | 275 | uint8_t table[SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))], |
| 274 | uint64_t i, | 276 | uint64_t i, |
| 275 | uint8_t val | 277 | uint8_t val |
| 276 | ) | 278 | ) |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index b37bcfb..53b1fad 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -1,15 +1,15 @@ | |||
| 1 | STATIC long long gendata_h48_dispatch( | 1 | STATIC long long gendata_h48_dispatch( |
| 2 | const char *, unsigned long long, unsigned char *); | 2 | const char *, unsigned long long, unsigned char *); |
| 3 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [static 1]); | 3 | STATIC uint64_t gendata_h48short(gendata_h48short_arg_t [NON_NULL]); |
| 4 | STATIC int64_t gendata_h48(gendata_h48_arg_t [static 1]); | 4 | STATIC int64_t gendata_h48(gendata_h48_arg_t [NON_NULL]); |
| 5 | STATIC void gendata_h48_maintable(gendata_h48_arg_t [static 1]); | 5 | STATIC void gendata_h48_maintable(gendata_h48_arg_t [NON_NULL]); |
| 6 | STATIC wrapthread_return_t gendata_h48_runthread(void *); | 6 | STATIC wrapthread_return_t gendata_h48_runthread(void *); |
| 7 | 7 | ||
| 8 | STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t [static 1]); | 8 | STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t [NON_NULL]); |
| 9 | STATIC_INLINE bool gendata_h48_dfs_stop( | 9 | STATIC_INLINE bool gendata_h48_dfs_stop( |
| 10 | cube_t, int8_t, h48_dfs_arg_t [static 1]); | 10 | cube_t, int8_t, h48_dfs_arg_t [NON_NULL]); |
| 11 | STATIC void gendata_h48_dfs(h48_dfs_arg_t [static 1]); | 11 | STATIC void gendata_h48_dfs(h48_dfs_arg_t [NON_NULL]); |
| 12 | STATIC tableinfo_t makeinfo_h48(gendata_h48_arg_t [static 1]); | 12 | STATIC tableinfo_t makeinfo_h48(gendata_h48_arg_t [NON_NULL]); |
| 13 | 13 | ||
| 14 | STATIC const uint32_t *get_cocsepdata_constptr(const unsigned char *); | 14 | STATIC const uint32_t *get_cocsepdata_constptr(const unsigned char *); |
| 15 | STATIC const unsigned char *get_h48data_constptr(const unsigned char *); | 15 | STATIC const unsigned char *get_h48data_constptr(const unsigned char *); |
| @@ -19,7 +19,7 @@ STATIC_INLINE void set_h48_pval(unsigned char *, uint64_t, uint8_t); | |||
| 19 | STATIC_INLINE uint8_t get_h48_pvalmin(const unsigned char *, uint64_t); | 19 | STATIC_INLINE uint8_t get_h48_pvalmin(const unsigned char *, uint64_t); |
| 20 | STATIC_INLINE void set_h48_pvalmin(unsigned char *, uint64_t, uint8_t); | 20 | STATIC_INLINE void set_h48_pvalmin(unsigned char *, uint64_t, uint8_t); |
| 21 | STATIC_INLINE uint8_t get_h48_pval_and_min( | 21 | STATIC_INLINE uint8_t get_h48_pval_and_min( |
| 22 | const unsigned char *, uint64_t, uint8_t [static 1]); | 22 | const unsigned char *, uint64_t, uint8_t [NON_NULL]); |
| 23 | 23 | ||
| 24 | STATIC long long | 24 | STATIC long long |
| 25 | gendata_h48_dispatch( | 25 | gendata_h48_dispatch( |
| @@ -43,7 +43,7 @@ gendata_h48_dispatch( | |||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | STATIC uint64_t | 45 | STATIC uint64_t |
| 46 | gendata_h48short(gendata_h48short_arg_t arg[static 1]) | 46 | gendata_h48short(gendata_h48short_arg_t arg[NON_NULL]) |
| 47 | { | 47 | { |
| 48 | uint8_t i, m; | 48 | uint8_t i, m; |
| 49 | uint64_t coord; | 49 | uint64_t coord; |
| @@ -77,7 +77,7 @@ gendata_h48short(gendata_h48short_arg_t arg[static 1]) | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | STATIC int64_t | 79 | STATIC int64_t |
| 80 | gendata_h48(gendata_h48_arg_t arg[static 1]) | 80 | gendata_h48(gendata_h48_arg_t arg[NON_NULL]) |
| 81 | { | 81 | { |
| 82 | uint64_t size, cocsepsize, h48size, eoesepsize; | 82 | uint64_t size, cocsepsize, h48size, eoesepsize; |
| 83 | long long r; | 83 | long long r; |
| @@ -149,7 +149,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) | |||
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | STATIC void | 151 | STATIC void |
| 152 | gendata_h48_maintable(gendata_h48_arg_t arg[static 1]) | 152 | gendata_h48_maintable(gendata_h48_arg_t arg[NON_NULL]) |
| 153 | { | 153 | { |
| 154 | /* | 154 | /* |
| 155 | * A good base value for the h48 tables have few positions with value | 155 | * A good base value for the h48 tables have few positions with value |
| @@ -264,7 +264,7 @@ gendata_h48_maintable(gendata_h48_arg_t arg[static 1]) | |||
| 264 | velocity = count; | 264 | velocity = count; |
| 265 | 265 | ||
| 266 | /* We plan to log 10 times */ | 266 | /* We plan to log 10 times */ |
| 267 | sleeptime = (100*(nshort-velocity)) / velocity; | 267 | sleeptime = (int)((100*(nshort-velocity)) / velocity); |
| 268 | 268 | ||
| 269 | done = count; | 269 | done = count; |
| 270 | while (nshort - done > (velocity * sleeptime) / 1000) { | 270 | while (nshort - done > (velocity * sleeptime) / 1000) { |
| @@ -320,7 +320,7 @@ gendata_h48_runthread(void *arg) | |||
| 320 | mutex = H48_LINE(coord) % CHUNKS; | 320 | mutex = H48_LINE(coord) % CHUNKS; |
| 321 | wrapthread_mutex_lock(dfsarg->table_mutex[mutex]); | 321 | wrapthread_mutex_lock(dfsarg->table_mutex[mutex]); |
| 322 | set_h48_pval(dfsarg->table, coordext, 0); | 322 | set_h48_pval(dfsarg->table, coordext, 0); |
| 323 | set_h48_pvalmin(dfsarg->table, coordmin, kv.val); | 323 | set_h48_pvalmin(dfsarg->table, coordmin, (uint8_t)kv.val); |
| 324 | wrapthread_mutex_unlock(dfsarg->table_mutex[mutex]); | 324 | wrapthread_mutex_unlock(dfsarg->table_mutex[mutex]); |
| 325 | } else { | 325 | } else { |
| 326 | dfsarg->cube = invcoord_h48(kv.key, dfsarg->crep, 11); | 326 | dfsarg->cube = invcoord_h48(kv.key, dfsarg->crep, 11); |
| @@ -332,7 +332,7 @@ gendata_h48_runthread(void *arg) | |||
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | STATIC void | 334 | STATIC void |
| 335 | gendata_h48_dfs(h48_dfs_arg_t arg[static 1]) | 335 | gendata_h48_dfs(h48_dfs_arg_t arg[NON_NULL]) |
| 336 | { | 336 | { |
| 337 | int8_t d; | 337 | int8_t d; |
| 338 | uint8_t m[4]; | 338 | uint8_t m[4]; |
| @@ -411,7 +411,7 @@ gendata_h48_dfs(h48_dfs_arg_t arg[static 1]) | |||
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | STATIC_INLINE void | 413 | STATIC_INLINE void |
| 414 | gendata_h48_mark(gendata_h48_mark_t arg[static 1]) | 414 | gendata_h48_mark(gendata_h48_mark_t arg[NON_NULL]) |
| 415 | { | 415 | { |
| 416 | uint8_t oldval, newval, v; | 416 | uint8_t oldval, newval, v; |
| 417 | uint64_t coord, coordext, coordmin; | 417 | uint64_t coord, coordext, coordmin; |
| @@ -435,7 +435,7 @@ gendata_h48_mark(gendata_h48_mark_t arg[static 1]) | |||
| 435 | } | 435 | } |
| 436 | 436 | ||
| 437 | STATIC_INLINE bool | 437 | STATIC_INLINE bool |
| 438 | gendata_h48_dfs_stop(cube_t cube, int8_t d, h48_dfs_arg_t arg[static 1]) | 438 | gendata_h48_dfs_stop(cube_t cube, int8_t d, h48_dfs_arg_t arg[NON_NULL]) |
| 439 | { | 439 | { |
| 440 | uint64_t val; | 440 | uint64_t val; |
| 441 | uint64_t coord, coordext; | 441 | uint64_t coord, coordext; |
| @@ -463,7 +463,7 @@ gendata_h48_dfs_stop(cube_t cube, int8_t d, h48_dfs_arg_t arg[static 1]) | |||
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | STATIC tableinfo_t | 465 | STATIC tableinfo_t |
| 466 | makeinfo_h48(gendata_h48_arg_t arg[static 1]) | 466 | makeinfo_h48(gendata_h48_arg_t arg[NON_NULL]) |
| 467 | { | 467 | { |
| 468 | tableinfo_t info; | 468 | tableinfo_t info; |
| 469 | 469 | ||
| @@ -533,7 +533,7 @@ STATIC_INLINE uint8_t | |||
| 533 | get_h48_pval_and_min( | 533 | get_h48_pval_and_min( |
| 534 | const unsigned char *table, | 534 | const unsigned char *table, |
| 535 | uint64_t coord_noext, | 535 | uint64_t coord_noext, |
| 536 | uint8_t pval_min[static 1] | 536 | uint8_t pval_min[NON_NULL] |
| 537 | ) | 537 | ) |
| 538 | { | 538 | { |
| 539 | uint64_t iext, imin; | 539 | uint64_t iext, imin; |
diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h index b603ee3..c9cfb06 100644 --- a/src/solvers/h48/map.h +++ b/src/solvers/h48/map.h | |||
| @@ -1,13 +1,13 @@ | |||
| 1 | STATIC void h48map_create(h48map_t [static 1], uint64_t, uint64_t); | 1 | STATIC void h48map_create(h48map_t [NON_NULL], uint64_t, uint64_t); |
| 2 | STATIC void h48map_clear(h48map_t [static 1]); | 2 | STATIC void h48map_clear(h48map_t [NON_NULL]); |
| 3 | STATIC void h48map_destroy(h48map_t [static 1]); | 3 | STATIC void h48map_destroy(h48map_t [NON_NULL]); |
| 4 | STATIC uint64_t h48map_lookup(h48map_t [static 1], uint64_t); | 4 | STATIC uint64_t h48map_lookup(h48map_t [NON_NULL], uint64_t); |
| 5 | STATIC void h48map_insertmin(h48map_t [static 1], uint64_t, uint64_t); | 5 | STATIC void h48map_insertmin(h48map_t [NON_NULL], uint64_t, uint64_t); |
| 6 | STATIC uint64_t h48map_value(h48map_t [static 1], uint64_t); | 6 | STATIC uint64_t h48map_value(h48map_t [NON_NULL], uint64_t); |
| 7 | STATIC kvpair_t h48map_nextkvpair(h48map_t [static 1], uint64_t [static 1]); | 7 | STATIC kvpair_t h48map_nextkvpair(h48map_t [NON_NULL], uint64_t [NON_NULL]); |
| 8 | 8 | ||
| 9 | STATIC void | 9 | STATIC void |
| 10 | h48map_create(h48map_t map[static 1], uint64_t capacity, uint64_t randomizer) | 10 | h48map_create(h48map_t map[NON_NULL], uint64_t capacity, uint64_t randomizer) |
| 11 | { | 11 | { |
| 12 | map->capacity = capacity; | 12 | map->capacity = capacity; |
| 13 | map->randomizer = randomizer; | 13 | map->randomizer = randomizer; |
| @@ -17,20 +17,20 @@ h48map_create(h48map_t map[static 1], uint64_t capacity, uint64_t randomizer) | |||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | STATIC void | 19 | STATIC void |
| 20 | h48map_clear(h48map_t map[static 1]) | 20 | h48map_clear(h48map_t map[NON_NULL]) |
| 21 | { | 21 | { |
| 22 | memset(map->table, 0xFF, map->capacity * sizeof(uint64_t)); | 22 | memset(map->table, 0xFF, map->capacity * sizeof(uint64_t)); |
| 23 | map->n = 0; | 23 | map->n = 0; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | STATIC void | 26 | STATIC void |
| 27 | h48map_destroy(h48map_t map[static 1]) | 27 | h48map_destroy(h48map_t map[NON_NULL]) |
| 28 | { | 28 | { |
| 29 | free(map->table); | 29 | free(map->table); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | STATIC_INLINE uint64_t | 32 | STATIC_INLINE uint64_t |
| 33 | h48map_lookup(h48map_t map[static 1], uint64_t x) | 33 | h48map_lookup(h48map_t map[NON_NULL], uint64_t x) |
| 34 | { | 34 | { |
| 35 | uint64_t hash, i; | 35 | uint64_t hash, i; |
| 36 | 36 | ||
| @@ -44,7 +44,7 @@ h48map_lookup(h48map_t map[static 1], uint64_t x) | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | STATIC_INLINE void | 46 | STATIC_INLINE void |
| 47 | h48map_insertmin(h48map_t map[static 1], uint64_t key, uint64_t val) | 47 | h48map_insertmin(h48map_t map[NON_NULL], uint64_t key, uint64_t val) |
| 48 | { | 48 | { |
| 49 | uint64_t i, oldval, min; | 49 | uint64_t i, oldval, min; |
| 50 | 50 | ||
| @@ -57,13 +57,13 @@ h48map_insertmin(h48map_t map[static 1], uint64_t key, uint64_t val) | |||
| 57 | } | 57 | } |
| 58 | 58 | ||
| 59 | STATIC_INLINE uint64_t | 59 | STATIC_INLINE uint64_t |
| 60 | h48map_value(h48map_t map[static 1], uint64_t key) | 60 | h48map_value(h48map_t map[NON_NULL], uint64_t key) |
| 61 | { | 61 | { |
| 62 | return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT; | 62 | return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | STATIC kvpair_t | 65 | STATIC kvpair_t |
| 66 | h48map_nextkvpair(h48map_t map[static 1], uint64_t p[static 1]) | 66 | h48map_nextkvpair(h48map_t map[NON_NULL], uint64_t p[NON_NULL]) |
| 67 | { | 67 | { |
| 68 | kvpair_t kv; | 68 | kvpair_t kv; |
| 69 | uint64_t pair; | 69 | uint64_t pair; |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 4fd0aea..ebc5208 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -64,27 +64,27 @@ typedef struct { | |||
| 64 | STATIC long long solve_h48_dispatch(oriented_cube_t, const char *, unsigned, | 64 | STATIC long long solve_h48_dispatch(oriented_cube_t, const char *, unsigned, |
| 65 | unsigned, unsigned, unsigned, unsigned, unsigned, unsigned long long, | 65 | unsigned, unsigned, unsigned, unsigned, unsigned, unsigned long long, |
| 66 | const unsigned char *, unsigned, char *, | 66 | const unsigned char *, unsigned, char *, |
| 67 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); | 67 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); |
| 68 | STATIC_INLINE void h48_prune_pipeline(dfsarg_solve_h48_t [static 1], | 68 | STATIC_INLINE void h48_prune_pipeline(dfsarg_solve_h48_t [NON_NULL], |
| 69 | h48_prune_t [static NMOVES], uint8_t, bool); | 69 | h48_prune_t [SIZE(NMOVES)], uint8_t, bool); |
| 70 | STATIC_INLINE uint8_t h48_prune_lookup( | 70 | STATIC_INLINE uint8_t h48_prune_lookup( |
| 71 | uint64_t, cube_t, dfsarg_solve_h48_t [static 1]); | 71 | uint64_t, cube_t, dfsarg_solve_h48_t [NON_NULL]); |
| 72 | STATIC_INLINE uint8_t h48_prune_lookup_nocoord( | 72 | STATIC_INLINE uint8_t h48_prune_lookup_nocoord( |
| 73 | cube_t, dfsarg_solve_h48_t [static 1]); | 73 | cube_t, dfsarg_solve_h48_t [NON_NULL]); |
| 74 | STATIC_INLINE void h48_prune_restore_normal(const h48_prune_t [static 1], | 74 | STATIC_INLINE void h48_prune_restore_normal(const h48_prune_t [NON_NULL], |
| 75 | dfsarg_solve_h48_t [static 1], uint8_t); | 75 | dfsarg_solve_h48_t [NON_NULL], uint8_t); |
| 76 | STATIC_INLINE void h48_prune_restore_inverse(const h48_prune_t [static 1], | 76 | STATIC_INLINE void h48_prune_restore_inverse(const h48_prune_t [NON_NULL], |
| 77 | dfsarg_solve_h48_t [static 1], uint8_t); | 77 | dfsarg_solve_h48_t [NON_NULL], uint8_t); |
| 78 | STATIC int64_t solve_h48_maketasks( | 78 | STATIC int64_t solve_h48_maketasks( |
| 79 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], | 79 | dfsarg_solve_h48_t [NON_NULL], dfsarg_solve_h48_maketasks_t [NON_NULL], |
| 80 | solve_h48_task_t [static H48_STARTING_CUBES], int [static 1]); | 80 | solve_h48_task_t [SIZE(H48_STARTING_CUBES)], int [NON_NULL]); |
| 81 | STATIC wrapthread_return_t solve_h48_runthread(void *); | 81 | STATIC wrapthread_return_t solve_h48_runthread(void *); |
| 82 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); | 82 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [NON_NULL]); |
| 83 | STATIC void solve_h48_log_solutions(solution_list_t [static 1], size_t); | 83 | STATIC void solve_h48_log_solutions(solution_list_t [NON_NULL], size_t); |
| 84 | STATIC int solve_h48_compare_tasks(const void *, const void *); | 84 | STATIC int solve_h48_compare_tasks(const void *, const void *); |
| 85 | STATIC int64_t solve_h48(oriented_cube_t, uint8_t, uint8_t, uint64_t, uint8_t, | 85 | STATIC int64_t solve_h48(oriented_cube_t, uint8_t, uint8_t, uint64_t, uint8_t, |
| 86 | uint8_t, uint64_t, const unsigned char *, size_t, char *, | 86 | uint8_t, uint64_t, const unsigned char *, size_t, char *, |
| 87 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); | 87 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); |
| 88 | 88 | ||
| 89 | STATIC long long solve_h48_dispatch( | 89 | STATIC long long solve_h48_dispatch( |
| 90 | oriented_cube_t oc, | 90 | oriented_cube_t oc, |
| @@ -99,7 +99,7 @@ STATIC long long solve_h48_dispatch( | |||
| 99 | const unsigned char *data, | 99 | const unsigned char *data, |
| 100 | unsigned sols_size, | 100 | unsigned sols_size, |
| 101 | char *sols, | 101 | char *sols, |
| 102 | long long stats[static NISSY_SIZE_SOLVE_STATS], | 102 | long long stats[SIZE(NISSY_SIZE_SOLVE_STATS)], |
| 103 | int (*poll_status)(void *), | 103 | int (*poll_status)(void *), |
| 104 | void *poll_status_data | 104 | void *poll_status_data |
| 105 | ) | 105 | ) |
| @@ -111,7 +111,8 @@ STATIC long long solve_h48_dispatch( | |||
| 111 | if (err != NISSY_OK) | 111 | if (err != NISSY_OK) |
| 112 | return err; | 112 | return err; |
| 113 | 113 | ||
| 114 | return solve_h48(oc, minmoves, maxmoves, maxsols, optimal, threads, | 114 | return solve_h48(oc, (uint8_t)minmoves, (uint8_t)maxmoves, |
| 115 | (uint8_t)maxsols, (uint8_t)optimal, (uint8_t)threads, | ||
| 115 | data_size, data, sols_size, sols, stats, | 116 | data_size, data, sols_size, sols, stats, |
| 116 | poll_status, poll_status_data); | 117 | poll_status, poll_status_data); |
| 117 | } | 118 | } |
| @@ -120,7 +121,7 @@ STATIC_INLINE uint8_t | |||
| 120 | h48_prune_lookup( | 121 | h48_prune_lookup( |
| 121 | uint64_t coord, | 122 | uint64_t coord, |
| 122 | cube_t cube, | 123 | cube_t cube, |
| 123 | dfsarg_solve_h48_t arg[static 1] | 124 | dfsarg_solve_h48_t arg[NON_NULL] |
| 124 | ) | 125 | ) |
| 125 | { | 126 | { |
| 126 | uint8_t p, pmin, pe; | 127 | uint8_t p, pmin, pe; |
| @@ -139,7 +140,7 @@ h48_prune_lookup( | |||
| 139 | STATIC_INLINE uint8_t | 140 | STATIC_INLINE uint8_t |
| 140 | h48_prune_lookup_nocoord( | 141 | h48_prune_lookup_nocoord( |
| 141 | cube_t cube, | 142 | cube_t cube, |
| 142 | dfsarg_solve_h48_t arg[static 1] | 143 | dfsarg_solve_h48_t arg[NON_NULL] |
| 143 | ) | 144 | ) |
| 144 | { | 145 | { |
| 145 | uint32_t cdata; | 146 | uint32_t cdata; |
| @@ -152,8 +153,8 @@ h48_prune_lookup_nocoord( | |||
| 152 | 153 | ||
| 153 | STATIC_INLINE void | 154 | STATIC_INLINE void |
| 154 | h48_prune_pipeline( | 155 | h48_prune_pipeline( |
| 155 | dfsarg_solve_h48_t arg[static 1], | 156 | dfsarg_solve_h48_t arg[NON_NULL], |
| 156 | h48_prune_t prune[static NMOVES], | 157 | h48_prune_t prune[SIZE(NMOVES)], |
| 157 | uint8_t target, | 158 | uint8_t target, |
| 158 | bool normal | 159 | bool normal |
| 159 | ) | 160 | ) |
| @@ -252,8 +253,8 @@ h48_prune_pipeline( | |||
| 252 | 253 | ||
| 253 | STATIC_INLINE void | 254 | STATIC_INLINE void |
| 254 | h48_prune_restore_normal( | 255 | h48_prune_restore_normal( |
| 255 | const h48_prune_t prune[static 1], | 256 | const h48_prune_t prune[NON_NULL], |
| 256 | dfsarg_solve_h48_t arg[static 1], | 257 | dfsarg_solve_h48_t arg[NON_NULL], |
| 257 | uint8_t target | 258 | uint8_t target |
| 258 | ) | 259 | ) |
| 259 | { | 260 | { |
| @@ -276,8 +277,8 @@ h48_prune_restore_normal( | |||
| 276 | 277 | ||
| 277 | STATIC_INLINE void | 278 | STATIC_INLINE void |
| 278 | h48_prune_restore_inverse( | 279 | h48_prune_restore_inverse( |
| 279 | const h48_prune_t prune[static 1], | 280 | const h48_prune_t prune[NON_NULL], |
| 280 | dfsarg_solve_h48_t arg[static 1], | 281 | dfsarg_solve_h48_t arg[NON_NULL], |
| 281 | uint8_t target | 282 | uint8_t target |
| 282 | ) | 283 | ) |
| 283 | { | 284 | { |
| @@ -299,7 +300,7 @@ h48_prune_restore_inverse( | |||
| 299 | } | 300 | } |
| 300 | 301 | ||
| 301 | STATIC int64_t | 302 | STATIC int64_t |
| 302 | solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | 303 | solve_h48_dfs(dfsarg_solve_h48_t arg[NON_NULL]) |
| 303 | { | 304 | { |
| 304 | int64_t ret, n; | 305 | int64_t ret, n; |
| 305 | uint8_t m, nm, nn, ni, target; | 306 | uint8_t m, nm, nn, ni, target; |
| @@ -343,7 +344,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | |||
| 343 | backup_inverse = arg->inverse; | 344 | backup_inverse = arg->inverse; |
| 344 | 345 | ||
| 345 | ret = 0; | 346 | ret = 0; |
| 346 | if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { | 347 | if (popcount_u64(mm_normal) <= popcount_u64(mm_inverse)) { |
| 347 | h48_prune_pipeline(arg, prune, target, true); | 348 | h48_prune_pipeline(arg, prune, target, true); |
| 348 | arg->solution_moves->nmoves++; | 349 | arg->solution_moves->nmoves++; |
| 349 | for (m = 0; m < NMOVES; m++) { | 350 | for (m = 0; m < NMOVES; m++) { |
| @@ -450,14 +451,13 @@ solve_h48_runthread_end: | |||
| 450 | 451 | ||
| 451 | STATIC int64_t | 452 | STATIC int64_t |
| 452 | solve_h48_maketasks( | 453 | solve_h48_maketasks( |
| 453 | dfsarg_solve_h48_t solve_arg[static 1], | 454 | dfsarg_solve_h48_t solve_arg[NON_NULL], |
| 454 | dfsarg_solve_h48_maketasks_t mtarg[static 1], | 455 | dfsarg_solve_h48_maketasks_t mtarg[NON_NULL], |
| 455 | solve_h48_task_t tasks[static H48_STARTING_CUBES], | 456 | solve_h48_task_t tasks[SIZE(H48_STARTING_CUBES)], |
| 456 | int ntasks[static 1] | 457 | int ntasks[NON_NULL] |
| 457 | ) | 458 | ) |
| 458 | { | 459 | { |
| 459 | int r; | 460 | int64_t r, appret; |
| 460 | int64_t appret; | ||
| 461 | uint8_t m, t; | 461 | uint8_t m, t; |
| 462 | uint64_t mm; | 462 | uint64_t mm; |
| 463 | cube_t backup_cube; | 463 | cube_t backup_cube; |
| @@ -524,7 +524,7 @@ solve_h48_maketasks( | |||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | STATIC void | 526 | STATIC void |
| 527 | solve_h48_log_solutions(solution_list_t s[static 1], size_t e) | 527 | solve_h48_log_solutions(solution_list_t s[NON_NULL], size_t e) |
| 528 | { | 528 | { |
| 529 | size_t i; | 529 | size_t i; |
| 530 | char b; | 530 | char b; |
| @@ -561,7 +561,7 @@ solve_h48( | |||
| 561 | const unsigned char *data, | 561 | const unsigned char *data, |
| 562 | size_t solutions_size, | 562 | size_t solutions_size, |
| 563 | char *solutions, | 563 | char *solutions, |
| 564 | long long stats[static NISSY_SIZE_SOLVE_STATS], | 564 | long long stats[SIZE(NISSY_SIZE_SOLVE_STATS)], |
| 565 | int (*poll_status)(void *), | 565 | int (*poll_status)(void *), |
| 566 | void *poll_status_data | 566 | void *poll_status_data |
| 567 | ) | 567 | ) |
diff --git a/src/solvers/h48/utils.h b/src/solvers/h48/utils.h index 27fb2e5..6d91108 100644 --- a/src/solvers/h48/utils.h +++ b/src/solvers/h48/utils.h | |||
| @@ -4,11 +4,11 @@ | |||
| 4 | #define H48_HMAX UINT8_C(7) | 4 | #define H48_HMAX UINT8_C(7) |
| 5 | #endif | 5 | #endif |
| 6 | 6 | ||
| 7 | long long parse_h48h(const char *, uint8_t [static 1]); | 7 | long long parse_h48h(const char *, uint8_t [NON_NULL]); |
| 8 | STATIC long long dataid_h48(const char *, char [static NISSY_SIZE_DATAID]); | 8 | STATIC long long dataid_h48(const char *, char [SIZE(NISSY_SIZE_DATAID)]); |
| 9 | 9 | ||
| 10 | long long | 10 | long long |
| 11 | parse_h48h(const char *buf, uint8_t h[static 1]) | 11 | parse_h48h(const char *buf, uint8_t h[NON_NULL]) |
| 12 | { | 12 | { |
| 13 | char format_error_msg[100]; | 13 | char format_error_msg[100]; |
| 14 | sprintf(format_error_msg, "[H48] Error parsing H48 solver: must be in " | 14 | sprintf(format_error_msg, "[H48] Error parsing H48 solver: must be in " |
| @@ -29,7 +29,7 @@ parse_h48h(const char *buf, uint8_t h[static 1]) | |||
| 29 | goto parse_h48h_error; | 29 | goto parse_h48h_error; |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | *h = atoi(buf); | 32 | *h = (uint8_t)atoi(buf); |
| 33 | if (*h > H48_HMAX) { | 33 | if (*h > H48_HMAX) { |
| 34 | LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be " | 34 | LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be " |
| 35 | "at most %" PRIu8 ")\n", *h, H48_HMAX); | 35 | "at most %" PRIu8 ")\n", *h, H48_HMAX); |
| @@ -51,7 +51,7 @@ parse_h48h_error: | |||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | STATIC long long | 53 | STATIC long long |
| 54 | dataid_h48(const char *str, char buf[static NISSY_SIZE_DATAID]) | 54 | dataid_h48(const char *str, char buf[SIZE(NISSY_SIZE_DATAID)]) |
| 55 | { | 55 | { |
| 56 | uint8_t h; | 56 | uint8_t h; |
| 57 | long long err; | 57 | long long err; |
