From a1ad0db8a6d829eddf1478cee44ae976bbcd325f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 6 Apr 2026 14:48:54 +0100 Subject: Fix integer conversions in code, tests and some tools --- src/solvers/h48/gendata_cocsep.h | 5 ++--- src/solvers/h48/gendata_eoesep.h | 8 +++++--- src/solvers/h48/gendata_h48.h | 4 ++-- src/solvers/h48/solve.h | 8 ++++---- src/solvers/h48/utils.h | 2 +- 5 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src/solvers/h48') 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: STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t arg[NON_NULL]) { - uint8_t m; + uint8_t m, t; uint32_t cc, class, ttrep, depth, olddepth, tinv; - uint64_t t; uint64_t i, j; cube_t d; cocsep_dfs_arg_t nextarg; @@ -105,7 +104,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[NON_NULL]) d = transform_corners(arg->cube, t); j = coord_cocsep(d); if (i == j && arg->selfsim != NULL) - arg->selfsim[*arg->n] |= UINT64_C(1) << t; + arg->selfsim[*arg->n] |= UINT64_C(1) << (uint64_t)t; if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF)) continue; 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( esep_classes[j] = cl | ti; visited[j] = true; } - rep[class] = i; + rep[class] = (uint16_t)i; class++; } @@ -140,7 +140,8 @@ gendata_eoesep_fromdone( ) { uint8_t pval; - uint64_t i, esep, eo, coord, done; + uint32_t done; + uint64_t i, esep, eo, coord; done = 0; for (i = 0; i < ESEP_CLASSES; i++) { @@ -169,7 +170,8 @@ gendata_eoesep_fromnew( ) { uint8_t pval; - uint64_t i, esep, eo, coord, done; + uint32_t done; + uint64_t i, esep, eo, coord; cube_t c; 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]) velocity = count; /* We plan to log 10 times */ - sleeptime = (100*(nshort-velocity)) / velocity; + sleeptime = (int)((100*(nshort-velocity)) / velocity); done = count; while (nshort - done > (velocity * sleeptime) / 1000) { @@ -320,7 +320,7 @@ gendata_h48_runthread(void *arg) mutex = H48_LINE(coord) % CHUNKS; wrapthread_mutex_lock(dfsarg->table_mutex[mutex]); set_h48_pval(dfsarg->table, coordext, 0); - set_h48_pvalmin(dfsarg->table, coordmin, kv.val); + set_h48_pvalmin(dfsarg->table, coordmin, (uint8_t)kv.val); wrapthread_mutex_unlock(dfsarg->table_mutex[mutex]); } else { 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( if (err != NISSY_OK) return err; - return solve_h48(oc, minmoves, maxmoves, maxsols, optimal, threads, + return solve_h48(oc, (uint8_t)minmoves, (uint8_t)maxmoves, + (uint8_t)maxsols, (uint8_t)optimal, (uint8_t)threads, data_size, data, sols_size, sols, stats, poll_status, poll_status_data); } @@ -343,7 +344,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[NON_NULL]) backup_inverse = arg->inverse; ret = 0; - if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { + if (popcount_u64(mm_normal) <= popcount_u64(mm_inverse)) { h48_prune_pipeline(arg, prune, target, true); arg->solution_moves->nmoves++; for (m = 0; m < NMOVES; m++) { @@ -456,8 +457,7 @@ solve_h48_maketasks( int ntasks[NON_NULL] ) { - int r; - int64_t appret; + int64_t r, appret; uint8_t m, t; uint64_t mm; 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]) goto parse_h48h_error; } - *h = atoi(buf); + *h = (uint8_t)atoi(buf); if (*h > H48_HMAX) { LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be " "at most %" PRIu8 ")\n", *h, H48_HMAX); -- cgit v1.3