From ea0387796a349c91032fbcb10f50c6ad8607b0f6 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 29 Jul 2025 12:12:43 +0200 Subject: All coordinates unsigned --- src/solvers/coord/dr.h | 8 ++---- src/solvers/coord/dreo.h | 6 ++--- src/solvers/coord/eo.h | 2 +- src/solvers/coord/gendata.h | 2 +- src/solvers/h48/coordinate.h | 28 ++++++++++----------- src/solvers/h48/coordinate_types_macros.h | 2 +- src/solvers/h48/gendata_cocsep.h | 12 ++++----- src/solvers/h48/gendata_eoesep.h | 42 +++++++++++++++---------------- src/solvers/h48/gendata_h48.h | 42 +++++++++++++++---------------- src/solvers/h48/gendata_types_macros.h | 10 ++++---- src/solvers/h48/map.h | 2 +- src/solvers/h48/solve.h | 10 ++++---- 12 files changed, 81 insertions(+), 85 deletions(-) (limited to 'src/solvers') diff --git a/src/solvers/coord/dr.h b/src/solvers/coord/dr.h index d986742..7f7af4f 100644 --- a/src/solvers/coord/dr.h +++ b/src/solvers/coord/dr.h @@ -12,10 +12,6 @@ STATIC size_t coordinate_dr_gendata(unsigned char *); STATIC bool is_eoco_solvable(cube_t); -/* TODO: remove the following two when all coordinates are converted to unsigned */ -STATIC uint64_t coord_co_u(cube_t c) { return (uint64_t)coord_co(c); } -STATIC cube_t invcoord_co_u(uint64_t i) { return invcoord_co((int64_t)i); } - STATIC coord_t coordinate_dr = { .name = "DR", .coord = &coordinate_dr_coord, @@ -54,8 +50,8 @@ STATIC coord_t coordinate_dr = { .coord = &coord_dreoesep_nosym, .cube = &invcoord_dreoesep_nosym, .max2 = POW_3_7, - .coord2 = &coord_co_u, - .cube2 = &invcoord_co_u, + .coord2 = &coord_co, + .cube2 = &invcoord_co, .merge = &coordinate_dr_merge, }, }; diff --git a/src/solvers/coord/dreo.h b/src/solvers/coord/dreo.h index f6fa3e9..31f7008 100644 --- a/src/solvers/coord/dreo.h +++ b/src/solvers/coord/dreo.h @@ -47,8 +47,8 @@ STATIC coord_t coordinate_dreo = { .coord = &coord_dresep_nosym, .cube = &invcoord_dresep_nosym, .max2 = POW_3_7, - .coord2 = &coord_co_u, - .cube2 = &invcoord_co_u, + .coord2 = &coord_co, + .cube2 = &invcoord_co, .merge = &coordinate_dreo_merge, }, }; @@ -56,7 +56,7 @@ STATIC coord_t coordinate_dreo = { STATIC uint64_t coord_dresep_nosym(cube_t cube) { - return (uint64_t)coord_esep(cube) / COMB_8_4; + return coord_esep(cube) / COMB_8_4; } STATIC cube_t diff --git a/src/solvers/coord/eo.h b/src/solvers/coord/eo.h index 7735319..b963832 100644 --- a/src/solvers/coord/eo.h +++ b/src/solvers/coord/eo.h @@ -44,7 +44,7 @@ STATIC cube_t coordinate_eo_cube(uint64_t c, const unsigned char *data) { cube_t cube = SOLVED_CUBE; - set_eo(&cube, (int64_t)c); + set_eo(&cube, c); return cube; } diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index 7118b08..678bfd7 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h @@ -29,7 +29,7 @@ gendata_coord_dispatch( return NISSY_ERROR_INVALID_SOLVER; } - return (int64_t)gendata_coord(coord, buf); + return gendata_coord(coord, buf); } STATIC size_t diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h index 9437fa7..a7f0087 100644 --- a/src/solvers/h48/coordinate.h +++ b/src/solvers/h48/coordinate.h @@ -1,17 +1,17 @@ -STATIC_INLINE int64_t coord_h48( +STATIC_INLINE uint64_t coord_h48( cube_t, const uint32_t [static COCSEP_TABLESIZE], uint8_t); -STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t); +STATIC_INLINE uint64_t coord_h48_edges(cube_t, uint64_t, uint8_t, uint8_t); STATIC_INLINE cube_t invcoord_h48( - int64_t, const cube_t [static COCSEP_CLASSES], uint8_t); + uint64_t, const cube_t [static COCSEP_CLASSES], uint8_t); -STATIC_INLINE int64_t +STATIC_INLINE uint64_t coord_h48( cube_t c, const uint32_t cocsepdata[static COCSEP_TABLESIZE], uint8_t h ) { - int64_t cocsep, coclass; + uint64_t cocsep, coclass; uint32_t data; uint8_t ttrep; @@ -19,24 +19,24 @@ coord_h48( cocsep = coord_cocsep(c); data = cocsepdata[cocsep]; - coclass = (int64_t)COCLASS(data); - ttrep = (int64_t)TTREP(data); + coclass = COCLASS(data); + ttrep = TTREP(data); return coord_h48_edges(c, coclass, ttrep, h); } -STATIC_INLINE int64_t -coord_h48_edges(cube_t c, int64_t coclass, uint8_t ttrep, uint8_t h) +STATIC_INLINE uint64_t +coord_h48_edges(cube_t c, uint64_t coclass, uint8_t ttrep, uint8_t h) { cube_t d; - int64_t esep, eo, edges; + uint64_t esep, eo, edges; d = transform_edges(c, ttrep); esep = coord_esep(d); eo = coord_eo(d); edges = (esep << 11) + eo; - return (coclass * H48_ESIZE(11) + edges) >> (11 - (int64_t)h); + return (coclass * H48_ESIZE(11) + edges) >> (11 - (uint64_t)h); } /* @@ -46,17 +46,17 @@ returned cube is a transformed cube of one that gives the correct value. */ STATIC_INLINE cube_t invcoord_h48( - int64_t i, + uint64_t i, const cube_t crep[static COCSEP_CLASSES], uint8_t h ) { cube_t ret; - int64_t hh, coclass, ee, esep, eo; + uint64_t hh, coclass, ee, esep, eo; DBG_ASSERT(h <= 11, "invcoord_h48: h must be between 0 and 11\n"); - hh = (int64_t)h; + hh = (uint64_t)h; coclass = i / H48_ESIZE(h); ee = i % H48_ESIZE(h); esep = ee >> hh; diff --git a/src/solvers/h48/coordinate_types_macros.h b/src/solvers/h48/coordinate_types_macros.h index 04462d6..cf24e47 100644 --- a/src/solvers/h48/coordinate_types_macros.h +++ b/src/solvers/h48/coordinate_types_macros.h @@ -1,4 +1,4 @@ -#define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (int64_t)(h)) +#define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (uint64_t)(h)) #define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) #define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16)) diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h index 5d14db7..db7ac95 100644 --- a/src/solvers/h48/gendata_cocsep.h +++ b/src/solvers/h48/gendata_cocsep.h @@ -2,9 +2,9 @@ STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); STATIC_INLINE bool gendata_cocsep_get_visited( - const uint8_t [static COCSEP_VISITEDSIZE], int64_t); + const uint8_t [static COCSEP_VISITEDSIZE], uint64_t); STATIC_INLINE void gendata_cocsep_set_visited( - uint8_t [static COCSEP_VISITEDSIZE], int64_t); + uint8_t [static COCSEP_VISITEDSIZE], uint64_t); STATIC_INLINE int8_t get_h48_cdata( cube_t, const uint32_t [static COCSEP_TABLESIZE], uint32_t *); @@ -84,7 +84,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) uint8_t m; uint32_t cc, class, ttrep, depth, olddepth, tinv; uint64_t t; - int64_t i, j; + uint64_t i, j; cube_t d; cocsep_dfs_arg_t nextarg; @@ -136,7 +136,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) STATIC_INLINE bool gendata_cocsep_get_visited( const uint8_t a[static COCSEP_VISITEDSIZE], - int64_t i + uint64_t i ) { return a[VISITED_IND(i)] & VISITED_MASK(i); @@ -145,7 +145,7 @@ gendata_cocsep_get_visited( STATIC_INLINE void gendata_cocsep_set_visited( uint8_t a[static COCSEP_VISITEDSIZE], - int64_t i + uint64_t i ) { a[VISITED_IND(i)] |= VISITED_MASK(i); @@ -158,7 +158,7 @@ get_h48_cdata( uint32_t *cdata ) { - int64_t coord; + uint64_t coord; coord = coord_cocsep(cube); *cdata = cocsepdata[coord]; diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h index 52e2b8b..e9a2794 100644 --- a/src/solvers/h48/gendata_eoesep.h +++ b/src/solvers/h48/gendata_eoesep.h @@ -1,4 +1,4 @@ -STATIC int64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); +STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); STATIC size_t gendata_esep_classes( uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); STATIC size_t gendata_eoesep(unsigned char *, uint8_t); @@ -8,22 +8,22 @@ STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); STATIC uint32_t gendata_eoesep_fromdone(uint8_t, uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); -STATIC uint32_t gendata_eoesep_marksim(int64_t, uint8_t, +STATIC uint32_t gendata_eoesep_marksim(uint64_t, uint8_t, uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); STATIC bool gendata_eoesep_next(cube_t, uint8_t, uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); STATIC uint8_t get_eoesep_pval( - const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t); + const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], uint64_t); STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t); STATIC void set_eoesep_pval( - uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], int64_t, uint8_t); + uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], uint64_t, uint8_t); -STATIC int64_t +STATIC uint64_t coord_eoesep_sym(cube_t c, const uint32_t esep_classes[static ESEP_MAX]) { uint8_t ttrep; uint32_t edata, class; - int64_t esep, eo; + uint64_t esep, eo; esep = coord_esep(c); edata = esep_classes[esep]; @@ -43,7 +43,7 @@ gendata_esep_classes( bool visited[ESEP_MAX]; uint8_t t; uint32_t class, cl, ti; - int64_t i, j; + uint64_t i, j; cube_t c; memset(visited, 0, ESEP_MAX * sizeof(bool)); @@ -73,7 +73,7 @@ gendata_eoesep(unsigned char *buf, uint8_t maxdepth) unsigned char *buf8; uint16_t rep[ESEP_CLASSES]; uint32_t *esep_classes, done, level; - int64_t coord; + uint64_t coord; tableinfo_t info; if (buf == NULL) @@ -140,18 +140,18 @@ gendata_eoesep_fromdone( ) { uint8_t pval; - int64_t i, esep, eo, coord, done; + uint64_t i, esep, eo, coord, done; done = 0; - for (i = 0; i < (int64_t)ESEP_CLASSES; i++) { + for (i = 0; i < ESEP_CLASSES; i++) { esep = rep[i]; for (eo = 0; eo < POW_2_11; eo++) { - coord = (i << INT64_C(11)) + eo; + coord = (i << UINT64_C(11)) + eo; pval = get_eoesep_pval(buf8, coord); if (pval != d-1) continue; - coord = (esep << INT64_C(11)) + eo; + coord = (esep << UINT64_C(11)) + eo; done += gendata_eoesep_marksim( coord, d, buf8, esep_classes); } @@ -169,19 +169,19 @@ gendata_eoesep_fromnew( ) { uint8_t pval; - int64_t i, esep, eo, coord, done; + uint64_t i, esep, eo, coord, done; cube_t c; done = 0; - for (i = 0; i < (int64_t)ESEP_CLASSES; i++) { + for (i = 0; i < ESEP_CLASSES; i++) { esep = rep[i]; for (eo = 0; eo < POW_2_11; eo++) { - coord = (i << INT64_C(11)) + eo; + coord = (i << UINT64_C(11)) + eo; pval = get_eoesep_pval(buf8, coord); if (pval != 15) continue; - c = invcoord_eoesep((esep << INT64_C(11)) + eo); + c = invcoord_eoesep((esep << UINT64_C(11)) + eo); if (gendata_eoesep_next(c, d, buf8, esep_classes)) { set_eoesep_pval(buf8, coord, d); done++; @@ -194,7 +194,7 @@ gendata_eoesep_fromnew( STATIC uint32_t gendata_eoesep_marksim( - int64_t i, + uint64_t i, uint8_t d, uint8_t buf8[static EOESEP_BUF], uint32_t esep_classes[static ESEP_MAX] @@ -232,7 +232,7 @@ gendata_eoesep_next( ) { uint8_t m, t, pval; - int64_t coord; + uint64_t coord; cube_t moved, transformed; for (t = 0; t < NTRANS; t++) { @@ -252,7 +252,7 @@ gendata_eoesep_next( STATIC uint8_t get_eoesep_pval( const uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], - int64_t i + uint64_t i ) { return (table[EOESEP_INDEX(i)] & EOESEP_MASK(i)) >> EOESEP_SHIFT(i); @@ -261,7 +261,7 @@ get_eoesep_pval( STATIC uint8_t get_eoesep_pval_cube(const unsigned char *data, cube_t c) { - int64_t coord; + uint64_t coord; coord = coord_eoesep_sym(c, (const uint32_t *)data); @@ -271,7 +271,7 @@ get_eoesep_pval_cube(const unsigned char *data, cube_t c) STATIC void set_eoesep_pval( uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], - int64_t i, + uint64_t i, uint8_t val ) { diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 72cb05d..c75556d 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h @@ -18,12 +18,12 @@ STATIC tableinfo_t makeinfo_h48k2(gendata_h48_arg_t [static 1]); STATIC const uint32_t *get_cocsepdata_constptr(const unsigned char *); STATIC const unsigned char *get_h48data_constptr(const unsigned char *); -STATIC_INLINE uint8_t get_h48_pval(const unsigned char *, int64_t, uint8_t); -STATIC_INLINE void set_h48_pval(unsigned char *, int64_t, uint8_t, uint8_t); +STATIC_INLINE uint8_t get_h48_pval(const unsigned char *, uint64_t, uint8_t); +STATIC_INLINE void set_h48_pval(unsigned char *, uint64_t, uint8_t, uint8_t); STATIC_INLINE uint8_t get_h48_pval_atomic( - _Atomic const unsigned char *, int64_t, uint8_t); + _Atomic const unsigned char *, uint64_t, uint8_t); STATIC_INLINE void set_h48_pval_atomic( - _Atomic unsigned char *, int64_t, uint8_t, uint8_t); + _Atomic unsigned char *, uint64_t, uint8_t, uint8_t); STATIC long long gendata_h48_dispatch( @@ -50,7 +50,7 @@ STATIC uint64_t gendata_h48short(gendata_h48short_arg_t arg[static 1]) { uint8_t i, m; - int64_t coord; + uint64_t coord; uint64_t j; kvpair_t kv; cube_t cube, d; @@ -106,7 +106,7 @@ gendata_h48(gendata_h48_arg_t arg[static 1]) if (arg->buf_size < size) { LOG("[H48 gendata] Error: buffer is too small " - "(needed %" PRId64 " bytes but received %" PRId64 ")\n", + "(needed %" PRId64 " bytes but received %" PRIu64 ")\n", size, arg->buf_size); return NISSY_ERROR_BUFFER_SIZE; } @@ -209,7 +209,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) { _Atomic unsigned char *table; uint8_t val; - int64_t i, sc, done, d, h48max; + uint64_t i, sc, done, d, h48max; uint64_t t, tt, isize, cc, bufsize; h48h0k4_bfs_arg_t bfsarg[THREADS]; pthread_t thread[THREADS]; @@ -233,7 +233,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) table = arg->h48buf + INFOSIZE; memset(table, 0xFF, H48_TABLESIZE(0, 4)); - h48max = (int64_t)H48_COORDMAX(0); + h48max = H48_COORDMAX(0); sc = coord_h48(SOLVED_CUBE, arg->cocsepdata, 0); set_h48_pval_atomic(table, sc, 4, 0); arg->info.distribution[0] = 1; @@ -249,13 +249,13 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) .selfsim = arg->selfsim, .crep = arg->crep, .start = isize * t, - .end = t == THREADS-1 ? (uint64_t)h48max : isize * (t+1), + .end = t == THREADS-1 ? h48max : isize * (t+1), }; for (tt = 0; tt < CHUNKS; tt++) bfsarg[t].table_mutex[tt] = &table_mutex[tt]; } for (done = 1, d = 1; done < h48max && d <= arg->maxdepth; d++) { - LOG("[H48 gendata] Generating depth %" PRId64 "\n", d); + LOG("[H48 gendata] Generating depth %" PRIu64 "\n", d); for (t = 0; t < THREADS; t++) { bfsarg[t].depth = d; @@ -274,7 +274,7 @@ gendata_h48h0k4(gendata_h48_arg_t arg[static 1]) done += cc; arg->info.distribution[d] = cc; - LOG("[H48 gendata] Found %" PRId64 "\n", cc); + LOG("[H48 gendata] Found %" PRIu64 "\n", cc); } arg->info.maxvalue = d - 1; @@ -289,7 +289,7 @@ gendata_h48h0k4_runthread(void *arg) uint8_t c, m; uint64_t i; - int64_t j; + uint64_t j; cube_t cube, moved; gendata_h48_mark_t markarg; h48h0k4_bfs_arg_t *bfsarg; @@ -394,7 +394,7 @@ gendata_h48k2(gendata_h48_arg_t arg[static 1]) uint8_t t; int sleeptime; unsigned char *table; - int64_t j; + uint64_t j; _Atomic uint64_t count; uint64_t i, ii, inext, bufsize, done, nshort, velocity; h48map_t shortcubes; @@ -510,7 +510,7 @@ gendata_h48k2_runthread(void *arg) pthread_mutex_unlock(dfsarg->shortcubes_mutex); if (kv.val < dfsarg->shortdepth) { - coord = kv.key >> (int64_t)(11 - dfsarg->h); + coord = kv.key >> (uint64_t)(11 - dfsarg->h); mutex = H48_INDEX(coord, dfsarg->k) % CHUNKS; pthread_mutex_lock(dfsarg->table_mutex[mutex]); set_h48_pval(dfsarg->table, coord, dfsarg->k, 0); @@ -607,7 +607,7 @@ STATIC_INLINE void gendata_h48_mark_atomic(gendata_h48_mark_t arg[static 1]) { uint8_t oldval, newval; - int64_t coord, mutex; + uint64_t coord, mutex; FOREACH_H48SIM(arg->cube, arg->cocsepdata, arg->selfsim, coord = coord_h48(arg->cube, arg->cocsepdata, arg->h); @@ -627,7 +627,7 @@ STATIC_INLINE void gendata_h48_mark(gendata_h48_mark_t arg[static 1]) { uint8_t oldval, newval; - int64_t coord, mutex; + uint64_t coord, mutex; FOREACH_H48SIM(arg->cube, arg->cocsepdata, arg->selfsim, coord = coord_h48(arg->cube, arg->cocsepdata, arg->h); @@ -644,7 +644,7 @@ STATIC_INLINE bool gendata_h48k2_dfs_stop(cube_t cube, int8_t d, h48k2_dfs_arg_t arg[static 1]) { uint64_t val; - int64_t coord, mutex; + uint64_t coord, mutex; int8_t oldval; if (arg->h == 0 || arg->h == 11) { @@ -705,19 +705,19 @@ get_h48data_constptr(const unsigned char *data) } STATIC_INLINE uint8_t -get_h48_pval(const unsigned char *table, int64_t i, uint8_t k) +get_h48_pval(const unsigned char *table, uint64_t i, uint8_t k) { return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); } STATIC_INLINE uint8_t -get_h48_pval_atomic(_Atomic const unsigned char *table, int64_t i, uint8_t k) +get_h48_pval_atomic(_Atomic const unsigned char *table, uint64_t i, uint8_t k) { return (table[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); } STATIC_INLINE void -set_h48_pval(unsigned char *table, int64_t i, uint8_t k, uint8_t val) +set_h48_pval(unsigned char *table, uint64_t i, uint8_t k, uint8_t val) { table[H48_INDEX(i, k)] = (table[H48_INDEX(i, k)] & (~H48_MASK(i, k))) | (val << H48_SHIFT(i, k)); @@ -726,7 +726,7 @@ set_h48_pval(unsigned char *table, int64_t i, uint8_t k, uint8_t val) STATIC_INLINE void set_h48_pval_atomic( _Atomic unsigned char *table, - int64_t i, + uint64_t i, uint8_t k, uint8_t val ) diff --git a/src/solvers/h48/gendata_types_macros.h b/src/solvers/h48/gendata_types_macros.h index 21f0134..9be8e0f 100644 --- a/src/solvers/h48/gendata_types_macros.h +++ b/src/solvers/h48/gendata_types_macros.h @@ -18,12 +18,12 @@ #define CBOUND_MASK UINT32_C(0xFF) #define CBOUND(x) ((x) & CBOUND_MASK) -#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * ESEP_MAX)) -#define H48_COORDMAX(h) (H48_COORDMAX_NOEO << (int64_t)(h)) +#define H48_COORDMAX_NOEO (COCSEP_CLASSES * ESEP_MAX) +#define H48_COORDMAX(h) (H48_COORDMAX_NOEO << (uint64_t)(h)) #define H48_DIV(k) ((size_t)8 / (size_t)(k)) #define H48_TABLESIZE(h, k) DIV_ROUND_UP((size_t)H48_COORDMAX((h)), H48_DIV(k)) -#define H48_COEFF(k) (INT64_C(8) / (int64_t)(k)) +#define H48_COEFF(k) (UINT64_C(8) / (uint64_t)(k)) #define H48_INDEX(i, k) ((i) / H48_COEFF(k)) #define H48_SHIFT(i, k) ((uint8_t)(k) * (uint8_t)((i) % H48_COEFF(k))) #define H48_MASK(i, k) ((UINT8_BIT(k) - UINT8_C(1)) << H48_SHIFT(i, k)) @@ -36,10 +36,10 @@ transforming edges, but we need to compose transformations (i.e. conjugate VAR_T by VAR_TTREP). */ #define FOREACH_H48SIM(ARG_CUBE, ARG_COCSEPDATA, ARG_SELFSIM, ARG_ACTION) \ - int64_t VAR_COCSEP = coord_cocsep(ARG_CUBE); \ + uint64_t VAR_COCSEP = coord_cocsep(ARG_CUBE); \ uint8_t VAR_TTREP = TTREP(ARG_COCSEPDATA[VAR_COCSEP]); \ uint8_t VAR_INVERSE_TTREP = inverse_trans(VAR_TTREP); \ - int64_t VAR_COCLASS = COCLASS(ARG_COCSEPDATA[VAR_COCSEP]); \ + uint64_t VAR_COCLASS = COCLASS(ARG_COCSEPDATA[VAR_COCSEP]); \ cube_t VAR_REP = transform(ARG_CUBE, VAR_TTREP); \ uint64_t VAR_S = ARG_SELFSIM[VAR_COCLASS]; \ for (uint8_t VAR_T = 0; VAR_T < NTRANS && VAR_S; VAR_T++, VAR_S >>= 1) { \ diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h index 7718794..b603ee3 100644 --- a/src/solvers/h48/map.h +++ b/src/solvers/h48/map.h @@ -12,7 +12,7 @@ h48map_create(h48map_t map[static 1], uint64_t capacity, uint64_t randomizer) map->capacity = capacity; map->randomizer = randomizer; - map->table = malloc(map->capacity * sizeof(int64_t)); + map->table = malloc(map->capacity * sizeof(uint64_t)); h48map_clear(map); } diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 6026ec7..50e4f99 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h @@ -36,9 +36,9 @@ typedef struct { const unsigned char *h48data_fallback_eoesep; uint64_t movemask_normal; uint64_t movemask_inverse; - int64_t nodes_visited; - int64_t table_fallbacks; - int64_t table_lookups; + uint64_t nodes_visited; + uint64_t table_fallbacks; + uint64_t table_lookups; int8_t threads; int ntasks; solve_h48_task_t *tasks; @@ -463,7 +463,7 @@ solve_h48( dfsarg_solve_h48_maketasks_t maketasks_arg; long double fallback_rate, lookups_per_node; uint64_t offset; - int64_t nodes_visited, table_lookups, table_fallbacks; + uint64_t nodes_visited, table_lookups, table_fallbacks; tableinfo_t info, fbinfo, fbinfo2; const uint32_t *cocsepdata; const unsigned char *fallback, *h48data; @@ -579,7 +579,7 @@ solve_h48( d++ ) { if (d >= H48_LOG_PROGRESS_MIN_DEPTH) { - LOG("[H48 solve] Found %" PRId64 " solutions, " + LOG("[H48 solve] Found %" PRIu64 " solutions, " "searching at depth %" PRId8 "\n", sollist.nsols, d); } -- cgit v1.3