diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 14:48:54 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 14:48:54 +0100 |
| commit | a1ad0db8a6d829eddf1478cee44ae976bbcd325f (patch) | |
| tree | a6e62232e05e7779034c5f9d1bf743b6f1c198e3 /src | |
| parent | 0d4fa9ebbfcadfff4baf8fc3cd32a63dcfd7dd43 (diff) | |
| download | nissy-core-c-portability.tar.gz nissy-core-c-portability.zip | |
Fix integer conversions in code, tests and some toolsc-portability
Diffstat (limited to 'src')
| -rw-r--r-- | src/arch/avx2.h | 2 | ||||
| -rw-r--r-- | src/core/moves.h | 8 | ||||
| -rw-r--r-- | src/core/transform.h | 5 | ||||
| -rw-r--r-- | src/nissy.c | 2 | ||||
| -rw-r--r-- | src/solvers/coord/common.h | 12 | ||||
| -rw-r--r-- | src/solvers/coord/gendata.h | 19 | ||||
| -rw-r--r-- | src/solvers/coord/multisolve.h | 12 | ||||
| -rw-r--r-- | src/solvers/coord/solve.h | 12 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_cocsep.h | 5 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_eoesep.h | 8 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 4 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 8 | ||||
| -rw-r--r-- | src/solvers/h48/utils.h | 2 | ||||
| -rw-r--r-- | src/solvers/solutions.h | 2 | ||||
| -rw-r--r-- | src/solvers/tables.h | 2 | ||||
| -rw-r--r-- | src/utils/math.h | 6 |
16 files changed, 58 insertions, 51 deletions
diff --git a/src/arch/avx2.h b/src/arch/avx2.h index 21a6f3b..801419e 100644 --- a/src/arch/avx2.h +++ b/src/arch/avx2.h | |||
| @@ -37,7 +37,7 @@ popcount_u32(uint32_t x) | |||
| 37 | STATIC_INLINE int | 37 | STATIC_INLINE int |
| 38 | popcount_u64(uint64_t x) | 38 | popcount_u64(uint64_t x) |
| 39 | { | 39 | { |
| 40 | return _mm_popcnt_u64(x); | 40 | return (int)_mm_popcnt_u64(x); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | STATIC void | 43 | STATIC void |
diff --git a/src/core/moves.h b/src/core/moves.h index c162c1d..9f1f7cc 100644 --- a/src/core/moves.h +++ b/src/core/moves.h | |||
| @@ -623,10 +623,10 @@ move_variations_lastqt( | |||
| 623 | size_t u; | 623 | size_t u; |
| 624 | moves_struct_t ss; | 624 | moves_struct_t ss; |
| 625 | 625 | ||
| 626 | in1 = s->nnormal-1; | 626 | in1 = (uint8_t)(s->nnormal-1); |
| 627 | in2 = s->nnormal-2; | 627 | in2 = (uint8_t)(s->nnormal-2); |
| 628 | ii1 = s->ninverse-1; | 628 | ii1 = (uint8_t)(s->ninverse-1); |
| 629 | ii2 = s->ninverse-2; | 629 | ii2 = (uint8_t)(s->ninverse-2); |
| 630 | 630 | ||
| 631 | n1 = in1 >= 0 ? s->normal[in1] : UINT8_ERROR; | 631 | n1 = in1 >= 0 ? s->normal[in1] : UINT8_ERROR; |
| 632 | n2 = in2 >= 0 ? s->normal[in2] : UINT8_ERROR; | 632 | n2 = in2 >= 0 ? s->normal[in2] : UINT8_ERROR; |
diff --git a/src/core/transform.h b/src/core/transform.h index 206449b..af4634e 100644 --- a/src/core/transform.h +++ b/src/core/transform.h | |||
| @@ -407,12 +407,13 @@ inverse_trans(uint8_t t) | |||
| 407 | STATIC uint64_t | 407 | STATIC uint64_t |
| 408 | symmetry_mask(cube_t cube) | 408 | symmetry_mask(cube_t cube) |
| 409 | { | 409 | { |
| 410 | uint64_t t, ret; | 410 | uint64_t ret; |
| 411 | uint8_t t; | ||
| 411 | cube_t transformed; | 412 | cube_t transformed; |
| 412 | 413 | ||
| 413 | for (t = 0, ret = 0; t < NTRANS; t++) { | 414 | for (t = 0, ret = 0; t < NTRANS; t++) { |
| 414 | transformed = transform(cube, t); | 415 | transformed = transform(cube, t); |
| 415 | ret |= ((uint64_t)equal(cube, transformed)) << t; | 416 | ret |= ((uint64_t)equal(cube, transformed)) << (uint64_t)t; |
| 416 | } | 417 | } |
| 417 | 418 | ||
| 418 | return ret; | 419 | return ret; |
diff --git a/src/nissy.c b/src/nissy.c index b9f2565..0811861 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -197,7 +197,7 @@ nissy_getcube( | |||
| 197 | getcube_options[i].fix(&ep, &eo, &cp, &co, &orient); | 197 | getcube_options[i].fix(&ep, &eo, &cp, &co, &orient); |
| 198 | 198 | ||
| 199 | oc.cube = getcube(ep, eo, cp, co); | 199 | oc.cube = getcube(ep, eo, cp, co); |
| 200 | oc.orientation = orient; | 200 | oc.orientation = (uint8_t)orient; |
| 201 | 201 | ||
| 202 | if (!isconsistent(oc)) { | 202 | if (!isconsistent(oc)) { |
| 203 | LOG("[getcube] Error: could not get cube with ep=%lld, " | 203 | LOG("[getcube] Error: could not get cube with ep=%lld, " |
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index 593641f..3a62e85 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -77,7 +77,8 @@ coord_gendata_generic( | |||
| 77 | unsigned char *data | 77 | unsigned char *data |
| 78 | ) | 78 | ) |
| 79 | { | 79 | { |
| 80 | uint64_t i, j, n, t, nasty; | 80 | uint64_t i, j, n, nasty; |
| 81 | uint8_t t; | ||
| 81 | unsigned char *datanoinfo; | 82 | unsigned char *datanoinfo; |
| 82 | uint32_t *classttrep, *rep; | 83 | uint32_t *classttrep, *rep; |
| 83 | size_t coord_datasize; | 84 | size_t coord_datasize; |
| @@ -122,16 +123,17 @@ coord_gendata_generic( | |||
| 122 | } | 123 | } |
| 123 | 124 | ||
| 124 | for (t = 0; t < NTRANS; t++) { | 125 | for (t = 0; t < NTRANS; t++) { |
| 125 | if (!((UINT64_C(1) << t) & coord->trans_mask)) | 126 | if (!((UINT64_C(1) << (uint64_t)t) & coord->trans_mask)) |
| 126 | continue; | 127 | continue; |
| 127 | 128 | ||
| 128 | j = coord->sym.coord(transform(c, t)); | 129 | j = coord->sym.coord(transform(c, t)); |
| 129 | classttrep[j] = | 130 | classttrep[j] = (uint32_t)( |
| 130 | (n << COORD_CLASS_SHIFT) | | 131 | (n << COORD_CLASS_SHIFT) | |
| 131 | (nasty << COORD_ISNASTY_SHIFT) | | 132 | (nasty << COORD_ISNASTY_SHIFT) | |
| 132 | (inverse_trans(t) << COORD_TTREP_SHIFT); | 133 | (inverse_trans(t) << COORD_TTREP_SHIFT) |
| 134 | ); | ||
| 133 | } | 135 | } |
| 134 | rep[n++] = i; | 136 | rep[n++] = (uint32_t)i; |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 137 | writetableinfo(&info, coord_datasize, data); | 139 | writetableinfo(&info, coord_datasize, data); |
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index f803044..edf6ce6 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -146,7 +146,8 @@ genptable_coord( | |||
| 146 | unsigned char *table | 146 | unsigned char *table |
| 147 | ) | 147 | ) |
| 148 | { | 148 | { |
| 149 | uint64_t tablesize, i, d, tot, t, nm; | 149 | uint64_t tablesize, i, tot, t, nm; |
| 150 | uint8_t d; | ||
| 150 | tableinfo_t info; | 151 | tableinfo_t info; |
| 151 | 152 | ||
| 152 | tablesize = DIV_ROUND_UP(coord->max, 2); | 153 | tablesize = DIV_ROUND_UP(coord->max, 2); |
| @@ -170,7 +171,7 @@ genptable_coord( | |||
| 170 | 171 | ||
| 171 | tot = info.distribution[0] = | 172 | tot = info.distribution[0] = |
| 172 | genptable_coord_init_solved(coord, data, table); | 173 | genptable_coord_init_solved(coord, data, table); |
| 173 | nm = popcount_u32(coord->moves_mask_gendata); | 174 | nm = popcount_u64(coord->moves_mask_gendata); |
| 174 | for (d = 1; tot < coord->max && d < 15; d++) { | 175 | for (d = 1; tot < coord->max && d < 15; d++) { |
| 175 | t = 0; | 176 | t = 0; |
| 176 | if (switch_to_fromnew(tot, coord->max, nm)) { | 177 | if (switch_to_fromnew(tot, coord->max, nm)) { |
| @@ -247,20 +248,21 @@ genptable_coord_fillneighbors( | |||
| 247 | { | 248 | { |
| 248 | bool isnasty; | 249 | bool isnasty; |
| 249 | uint8_t m; | 250 | uint8_t m; |
| 250 | uint64_t ii, j, t, tot; | 251 | uint64_t ii, j, tot; |
| 252 | uint8_t t; | ||
| 251 | cube_t c, moved; | 253 | cube_t c, moved; |
| 252 | 254 | ||
| 253 | c = coord->cube(i, data); | 255 | c = coord->cube(i, data); |
| 254 | tot = 0; | 256 | tot = 0; |
| 255 | for (m = 0; m < NMOVES; m++) { | 257 | for (m = 0; m < NMOVES; m++) { |
| 256 | if (!((UINT32_C(1) << (uint32_t)m) & | 258 | if (!((UINT64_C(1) << (uint64_t)m) & |
| 257 | coord->moves_mask_gendata)) | 259 | coord->moves_mask_gendata)) |
| 258 | continue; | 260 | continue; |
| 259 | moved = move(c, m); | 261 | moved = move(c, m); |
| 260 | ii = coord->coord(moved, data); | 262 | ii = coord->coord(moved, data); |
| 261 | isnasty = coord->isnasty(ii, data); | 263 | isnasty = coord->isnasty(ii, data); |
| 262 | for (t = 0; t < NTRANS && (t == 0 || isnasty); t++) { | 264 | for (t = 0; t < NTRANS && (t == 0 || isnasty); t++) { |
| 263 | if (!((UINT64_C(1) << t) & coord->trans_mask)) | 265 | if (!((UINT64_C(1) << (uint64_t)t) & coord->trans_mask)) |
| 264 | continue; | 266 | continue; |
| 265 | 267 | ||
| 266 | j = coord->coord(transform(moved, t), data); | 268 | j = coord->coord(transform(moved, t), data); |
| @@ -285,14 +287,15 @@ genptable_coord_fillfromnew( | |||
| 285 | { | 287 | { |
| 286 | bool found; | 288 | bool found; |
| 287 | uint8_t m; | 289 | uint8_t m; |
| 288 | uint64_t tot, t, ii, j, nsim, sim[NTRANS]; | 290 | uint64_t tot, j, ii, nsim, sim[NTRANS]; |
| 291 | uint8_t t; | ||
| 289 | cube_t c; | 292 | cube_t c; |
| 290 | 293 | ||
| 291 | tot = 0; | 294 | tot = 0; |
| 292 | c = coord->cube(i, data); | 295 | c = coord->cube(i, data); |
| 293 | 296 | ||
| 294 | for (t = 0, nsim = 0; t < NTRANS; t++) { | 297 | for (t = 0, nsim = 0; t < NTRANS; t++) { |
| 295 | if (!((UINT64_C(1) << t) & coord->trans_mask)) | 298 | if (!((UINT64_C(1) << (uint64_t)t) & coord->trans_mask)) |
| 296 | continue; | 299 | continue; |
| 297 | 300 | ||
| 298 | ii = coord->coord(transform(c, t), data); | 301 | ii = coord->coord(transform(c, t), data); |
| @@ -305,7 +308,7 @@ genptable_coord_fillfromnew( | |||
| 305 | for (j = 0, found = false; j < nsim && !found; j++) { | 308 | for (j = 0, found = false; j < nsim && !found; j++) { |
| 306 | c = coord->cube(sim[j], data); | 309 | c = coord->cube(sim[j], data); |
| 307 | for (m = 0; m < NMOVES; m++) { | 310 | for (m = 0; m < NMOVES; m++) { |
| 308 | if (!((UINT32_C(1) << (uint32_t)m) & | 311 | if (!((UINT64_C(1) << (uint64_t)m) & |
| 309 | coord->moves_mask_gendata)) | 312 | coord->moves_mask_gendata)) |
| 310 | continue; | 313 | continue; |
| 311 | ii = coord->coord(move(c, m), data); | 314 | ii = coord->coord(move(c, m), data); |
diff --git a/src/solvers/coord/multisolve.h b/src/solvers/coord/multisolve.h index 28f03bb..efd287d 100644 --- a/src/solvers/coord/multisolve.h +++ b/src/solvers/coord/multisolve.h | |||
| @@ -72,8 +72,7 @@ STATIC int64_t | |||
| 72 | solve_multicoord_dfs(dfsarg_solve_multicoord_t arg[NON_NULL]) | 72 | solve_multicoord_dfs(dfsarg_solve_multicoord_t arg[NON_NULL]) |
| 73 | { | 73 | { |
| 74 | uint8_t m, l, i; | 74 | uint8_t m, l, i; |
| 75 | uint32_t mm; | 75 | uint64_t mm, coord; |
| 76 | uint64_t coord; | ||
| 77 | int64_t n, ret; | 76 | int64_t n, ret; |
| 78 | const coord_t *c; | 77 | const coord_t *c; |
| 79 | cube_t backup_cube, backup_inverse; | 78 | cube_t backup_cube, backup_inverse; |
| @@ -108,7 +107,7 @@ solve_multicoord_dfs_notsolved: | |||
| 108 | arg->solution_moves->nmoves++; | 107 | arg->solution_moves->nmoves++; |
| 109 | 108 | ||
| 110 | for (m = 0; m < NMOVES; m++) { | 109 | for (m = 0; m < NMOVES; m++) { |
| 111 | if (!(mm & (UINT32_C(1) << (uint32_t)m))) | 110 | if (!(mm & (UINT64_C(1) << (uint64_t)m))) |
| 112 | continue; | 111 | continue; |
| 113 | 112 | ||
| 114 | arg->solution_moves->moves[l] = m; | 113 | arg->solution_moves->moves[l] = m; |
| @@ -163,9 +162,10 @@ solve_multicoord_dispatch( | |||
| 163 | return NISSY_ERROR_INVALID_SOLVER; | 162 | return NISSY_ERROR_INVALID_SOLVER; |
| 164 | } | 163 | } |
| 165 | 164 | ||
| 166 | return solve_multicoord(oc, mcoord, trans, minmoves, | 165 | return solve_multicoord(oc, mcoord, trans, (uint8_t)minmoves, |
| 167 | maxmoves, maxsolutions, optimal, threads, data_size, data, | 166 | (uint8_t)maxmoves, (uint8_t)maxsolutions, (uint8_t)optimal, |
| 168 | solutions_size, sols, poll_status, poll_status_data); | 167 | (uint8_t)threads, data_size, data, solutions_size, sols, |
| 168 | poll_status, poll_status_data); | ||
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | STATIC int64_t | 171 | STATIC int64_t |
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index fcdb06e..6bb9af2 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -151,8 +151,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[NON_NULL]) | |||
| 151 | { | 151 | { |
| 152 | bool lastbackup; | 152 | bool lastbackup; |
| 153 | uint8_t m, l, nnbackup, nibackup, nmoves; | 153 | uint8_t m, l, nnbackup, nibackup, nmoves; |
| 154 | uint32_t mm; | 154 | uint64_t mm, coord; |
| 155 | uint64_t coord; | ||
| 156 | int64_t n, ret; | 155 | int64_t n, ret; |
| 157 | cube_t backup_cube, backup_inverse; | 156 | cube_t backup_cube, backup_inverse; |
| 158 | 157 | ||
| @@ -190,7 +189,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[NON_NULL]) | |||
| 190 | arg->lastisnormal = true; | 189 | arg->lastisnormal = true; |
| 191 | 190 | ||
| 192 | for (m = 0; m < NMOVES; m++) { | 191 | for (m = 0; m < NMOVES; m++) { |
| 193 | if (!(mm & (UINT32_C(1) << (uint32_t)m))) | 192 | if (!(mm & (UINT64_C(1) << (uint64_t)m))) |
| 194 | continue; | 193 | continue; |
| 195 | 194 | ||
| 196 | arg->solution_moves->moves[l] = m; | 195 | arg->solution_moves->moves[l] = m; |
| @@ -221,7 +220,7 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[NON_NULL]) | |||
| 221 | arg->lastisnormal = false; | 220 | arg->lastisnormal = false; |
| 222 | 221 | ||
| 223 | for (m = 0; m < NMOVES; m++) { | 222 | for (m = 0; m < NMOVES; m++) { |
| 224 | if (!(mm & (UINT32_C(1) << (uint32_t)m))) | 223 | if (!(mm & (UINT64_C(1) << (uint64_t)m))) |
| 225 | continue; | 224 | continue; |
| 226 | 225 | ||
| 227 | arg->solution_moves->premoves[l] = m; | 226 | arg->solution_moves->premoves[l] = m; |
| @@ -280,8 +279,9 @@ solve_coord_dispatch( | |||
| 280 | return NISSY_ERROR_INVALID_SOLVER; | 279 | return NISSY_ERROR_INVALID_SOLVER; |
| 281 | } | 280 | } |
| 282 | 281 | ||
| 283 | return solve_coord(oc, coord, trans, nissflag, minmoves, maxmoves, | 282 | return solve_coord(oc, coord, trans, (uint8_t)nissflag, |
| 284 | maxsolutions, optimal, threads, data_size, data, | 283 | (uint8_t)minmoves, (uint8_t)maxmoves, (uint8_t)maxsolutions, |
| 284 | (uint8_t)optimal, (uint8_t)threads, data_size, data, | ||
| 285 | solutions_size, sols, poll_status, poll_status_data); | 285 | solutions_size, sols, poll_status, poll_status_data); |
| 286 | } | 286 | } |
| 287 | 287 | ||
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index 17568ea..f83207b 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h | |||
| @@ -81,9 +81,8 @@ gendata_cocsep_return_size: | |||
| 81 | STATIC uint32_t | 81 | STATIC uint32_t |
| 82 | gendata_cocsep_dfs(cocsep_dfs_arg_t arg[NON_NULL]) | 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[NON_NULL]) | |||
| 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); |
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h index 271e877..81bbd43 100644 --- a/src/solvers/h48/gendata_eoesep.h +++ b/src/solvers/h48/gendata_eoesep.h | |||
| @@ -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 | ||
| @@ -140,7 +140,8 @@ gendata_eoesep_fromdone( | |||
| 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++) { |
| @@ -169,7 +170,8 @@ gendata_eoesep_fromnew( | |||
| 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; |
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 283c472..53b1fad 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -264,7 +264,7 @@ gendata_h48_maintable(gendata_h48_arg_t arg[NON_NULL]) | |||
| 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); |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 295ef88..ebc5208 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -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 | } |
| @@ -343,7 +344,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[NON_NULL]) | |||
| 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++) { |
| @@ -456,8 +457,7 @@ solve_h48_maketasks( | |||
| 456 | int ntasks[NON_NULL] | 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; |
diff --git a/src/solvers/h48/utils.h b/src/solvers/h48/utils.h index d181eab..6d91108 100644 --- a/src/solvers/h48/utils.h +++ b/src/solvers/h48/utils.h | |||
| @@ -29,7 +29,7 @@ parse_h48h(const char *buf, uint8_t h[NON_NULL]) | |||
| 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); |
diff --git a/src/solvers/solutions.h b/src/solvers/solutions.h index beedc64..b7a848b 100644 --- a/src/solvers/solutions.h +++ b/src/solvers/solutions.h | |||
| @@ -33,7 +33,7 @@ solution_moves_transform(solution_moves_t moves[NON_NULL], size_t z, uint8_t t) | |||
| 33 | { | 33 | { |
| 34 | uint8_t i; | 34 | uint8_t i; |
| 35 | 35 | ||
| 36 | for (i = z; i < moves->nmoves; i++) | 36 | for (i = (uint8_t)z; i < moves->nmoves; i++) |
| 37 | moves->moves[i] = transform_move(moves->moves[i], t); | 37 | moves->moves[i] = transform_move(moves->moves[i], t); |
| 38 | 38 | ||
| 39 | for (i = 0; i < moves->npremoves; i++) | 39 | for (i = 0; i < moves->npremoves; i++) |
diff --git a/src/solvers/tables.h b/src/solvers/tables.h index 8211ab3..3db1d1e 100644 --- a/src/solvers/tables.h +++ b/src/solvers/tables.h | |||
| @@ -140,7 +140,7 @@ writetableinfo( | |||
| 140 | STATIC void | 140 | STATIC void |
| 141 | append_name(tableinfo_t info[NON_NULL], const char *str) | 141 | append_name(tableinfo_t info[NON_NULL], const char *str) |
| 142 | { | 142 | { |
| 143 | int i, j; | 143 | size_t i, j; |
| 144 | 144 | ||
| 145 | for (i = 0, j = strlen(info->solver); str[i] != '\0'; i++, j++) | 145 | for (i = 0, j = strlen(info->solver); str[i] != '\0'; i++, j++) |
| 146 | info->solver[j] = str[i]; | 146 | info->solver[j] = str[i]; |
diff --git a/src/utils/math.h b/src/utils/math.h index f2176b6..0c56861 100644 --- a/src/utils/math.h +++ b/src/utils/math.h | |||
| @@ -73,10 +73,10 @@ indextoperm(uint64_t p, size_t n, uint8_t *r) | |||
| 73 | 73 | ||
| 74 | /* Find k-th unused number */ | 74 | /* Find k-th unused number */ |
| 75 | for (j = 0, c = 0; c <= k; j++) | 75 | for (j = 0, c = 0; c <= k; j++) |
| 76 | c += 1 - ((used & (1<<j)) >> j); | 76 | c += UINT64_C(1) - ((used & (UINT64_C(1)<<j)) >> j); |
| 77 | 77 | ||
| 78 | r[i] = j-1; | 78 | r[i] = (uint8_t)(j-1); |
| 79 | used |= 1 << (j-1); | 79 | used |= UINT64_C(1) << (j-1); |
| 80 | p %= factorial[n-i-1]; | 80 | p %= factorial[n-i-1]; |
| 81 | } | 81 | } |
| 82 | 82 | ||
