diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:33:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:44:07 +0200 |
| commit | 510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 (patch) | |
| tree | 58df7791242d9a4f52e80da93ad3af20ed5e3528 /src/solvers/coord | |
| parent | 1d9b8acfeece68c4f55d2499d8aed127f98a383c (diff) | |
| download | nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.tar.gz nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.zip | |
Always use unsigned char * for data buffers
Before this commit I was inconsistently using one of void *, char *
and uint8_t *.
Diffstat (limited to 'src/solvers/coord')
| -rw-r--r-- | src/solvers/coord/common.h | 46 | ||||
| -rw-r--r-- | src/solvers/coord/dr.h | 16 | ||||
| -rw-r--r-- | src/solvers/coord/dreo.h | 16 | ||||
| -rw-r--r-- | src/solvers/coord/eo.h | 16 | ||||
| -rw-r--r-- | src/solvers/coord/gendata.h | 54 | ||||
| -rw-r--r-- | src/solvers/coord/solve.h | 26 | ||||
| -rw-r--r-- | src/solvers/coord/types_macros.h | 8 |
7 files changed, 95 insertions, 87 deletions
diff --git a/src/solvers/coord/common.h b/src/solvers/coord/common.h index 2eb5ad0..8fd405c 100644 --- a/src/solvers/coord/common.h +++ b/src/solvers/coord/common.h | |||
| @@ -1,25 +1,29 @@ | |||
| 1 | STATIC uint64_t coord_coord_generic( | 1 | STATIC uint64_t coord_coord_generic( |
| 2 | const coord_t [static 1], cube_t, const void *); | 2 | const coord_t [static 1], cube_t, const unsigned char *); |
| 3 | STATIC cube_t coord_cube_generic( | 3 | STATIC cube_t coord_cube_generic( |
| 4 | const coord_t [static 1], uint64_t, const void *); | 4 | const coord_t [static 1], uint64_t, const unsigned char *); |
| 5 | STATIC bool coord_isnasty_generic( | 5 | STATIC bool coord_isnasty_generic( |
| 6 | const coord_t [static 1], uint64_t, const void *); | 6 | const coord_t [static 1], uint64_t, const unsigned char *); |
| 7 | STATIC size_t coord_gendata_generic(const coord_t [static 1], void *); | 7 | STATIC size_t coord_gendata_generic(const coord_t [static 1], unsigned char *); |
| 8 | 8 | ||
| 9 | STATIC void append_coord_name(const coord_t [static 1], char *); | 9 | STATIC void append_coord_name(const coord_t [static 1], char *); |
| 10 | STATIC bool solution_lastqt_cw(const solution_moves_t [static 1]); | 10 | STATIC bool solution_lastqt_cw(const solution_moves_t [static 1]); |
| 11 | STATIC bool coord_can_switch( | 11 | STATIC bool coord_can_switch(const coord_t [static 1], const unsigned char *, |
| 12 | const coord_t [static 1], const void *, size_t n, const uint8_t [n]); | 12 | size_t n, const uint8_t [n]); |
| 13 | 13 | ||
| 14 | STATIC uint64_t | 14 | STATIC uint64_t |
| 15 | coord_coord_generic(const coord_t coord[static 1], cube_t c, const void *data) | 15 | coord_coord_generic( |
| 16 | const coord_t coord[static 1], | ||
| 17 | cube_t c, | ||
| 18 | const unsigned char *data | ||
| 19 | ) | ||
| 16 | { | 20 | { |
| 17 | const char *datanoinfo; | 21 | const unsigned char *datanoinfo; |
| 18 | const uint32_t *data32; | 22 | const uint32_t *data32; |
| 19 | uint32_t d; | 23 | uint32_t d; |
| 20 | cube_t tr; | 24 | cube_t tr; |
| 21 | 25 | ||
| 22 | datanoinfo = (const char *)data + INFOSIZE; | 26 | datanoinfo = data + INFOSIZE; |
| 23 | data32 = (const uint32_t *)datanoinfo; | 27 | data32 = (const uint32_t *)datanoinfo; |
| 24 | d = data32[coord->sym.coord(c)]; | 28 | d = data32[coord->sym.coord(c)]; |
| 25 | tr = transform(c, COORD_TTREP(d)); | 29 | tr = transform(c, COORD_TTREP(d)); |
| @@ -28,13 +32,17 @@ coord_coord_generic(const coord_t coord[static 1], cube_t c, const void *data) | |||
| 28 | } | 32 | } |
| 29 | 33 | ||
| 30 | STATIC cube_t | 34 | STATIC cube_t |
| 31 | coord_cube_generic(const coord_t coord[static 1], uint64_t i, const void *data) | 35 | coord_cube_generic( |
| 36 | const coord_t coord[static 1], | ||
| 37 | uint64_t i, | ||
| 38 | const unsigned char *data | ||
| 39 | ) | ||
| 32 | { | 40 | { |
| 33 | const char *datanoinfo; | 41 | const unsigned char *datanoinfo; |
| 34 | const uint32_t *rep32; | 42 | const uint32_t *rep32; |
| 35 | cube_t c; | 43 | cube_t c; |
| 36 | 44 | ||
| 37 | datanoinfo = (const char *)data + INFOSIZE; | 45 | datanoinfo = data + INFOSIZE; |
| 38 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); | 46 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); |
| 39 | c = coord->sym.cube(rep32[i / coord->sym.max2]); | 47 | c = coord->sym.cube(rep32[i / coord->sym.max2]); |
| 40 | 48 | ||
| @@ -45,14 +53,14 @@ STATIC bool | |||
| 45 | coord_isnasty_generic( | 53 | coord_isnasty_generic( |
| 46 | const coord_t coord[static 1], | 54 | const coord_t coord[static 1], |
| 47 | uint64_t i, | 55 | uint64_t i, |
| 48 | const void *data | 56 | const unsigned char *data |
| 49 | ) | 57 | ) |
| 50 | { | 58 | { |
| 51 | const char *datanoinfo; | 59 | const unsigned char *datanoinfo; |
| 52 | const uint32_t *classttrep, *rep32; | 60 | const uint32_t *classttrep, *rep32; |
| 53 | uint32_t r; | 61 | uint32_t r; |
| 54 | 62 | ||
| 55 | datanoinfo = (const char *)data + INFOSIZE; | 63 | datanoinfo = data + INFOSIZE; |
| 56 | classttrep = (const uint32_t *)datanoinfo; | 64 | classttrep = (const uint32_t *)datanoinfo; |
| 57 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); | 65 | rep32 = (const uint32_t *)(datanoinfo + 4 * (size_t)coord->sym.max); |
| 58 | r = rep32[i / coord->sym.max2]; | 66 | r = rep32[i / coord->sym.max2]; |
| @@ -63,11 +71,11 @@ coord_isnasty_generic( | |||
| 63 | STATIC size_t | 71 | STATIC size_t |
| 64 | coord_gendata_generic( | 72 | coord_gendata_generic( |
| 65 | const coord_t coord[static 1], | 73 | const coord_t coord[static 1], |
| 66 | void *data | 74 | unsigned char *data |
| 67 | ) | 75 | ) |
| 68 | { | 76 | { |
| 69 | uint64_t i, j, n, t, nasty; | 77 | uint64_t i, j, n, t, nasty; |
| 70 | char *datanoinfo; | 78 | unsigned char *datanoinfo; |
| 71 | uint32_t *classttrep, *rep; | 79 | uint32_t *classttrep, *rep; |
| 72 | size_t coord_datasize; | 80 | size_t coord_datasize; |
| 73 | cube_t c; | 81 | cube_t c; |
| @@ -78,7 +86,7 @@ coord_gendata_generic( | |||
| 78 | if (data == NULL) | 86 | if (data == NULL) |
| 79 | return coord_datasize; | 87 | return coord_datasize; |
| 80 | 88 | ||
| 81 | datanoinfo = (char *)data + INFOSIZE; | 89 | datanoinfo = data + INFOSIZE; |
| 82 | classttrep = (uint32_t *)datanoinfo; | 90 | classttrep = (uint32_t *)datanoinfo; |
| 83 | rep = classttrep + coord->sym.max; | 91 | rep = classttrep + coord->sym.max; |
| 84 | memset(data, 0xFF, coord_datasize); | 92 | memset(data, 0xFF, coord_datasize); |
| @@ -154,7 +162,7 @@ solution_lastqt_cw(const solution_moves_t s[static 1]) | |||
| 154 | STATIC bool | 162 | STATIC bool |
| 155 | coord_can_switch( | 163 | coord_can_switch( |
| 156 | const coord_t coord[static 1], | 164 | const coord_t coord[static 1], |
| 157 | const void *data, | 165 | const unsigned char *data, |
| 158 | size_t n, | 166 | size_t n, |
| 159 | const uint8_t moves[n] | 167 | const uint8_t moves[n] |
| 160 | ) | 168 | ) |
diff --git a/src/solvers/coord/dr.h b/src/solvers/coord/dr.h index 3bc4c6d..e197f8c 100644 --- a/src/solvers/coord/dr.h +++ b/src/solvers/coord/dr.h | |||
| @@ -5,10 +5,10 @@ STATIC uint64_t coord_dreoesep_nosym(cube_t); | |||
| 5 | STATIC cube_t invcoord_dreoesep_nosym(uint64_t); | 5 | STATIC cube_t invcoord_dreoesep_nosym(uint64_t); |
| 6 | STATIC cube_t coordinate_dr_merge(cube_t, cube_t); | 6 | STATIC cube_t coordinate_dr_merge(cube_t, cube_t); |
| 7 | 7 | ||
| 8 | STATIC uint64_t coordinate_dr_coord(cube_t, const void *); | 8 | STATIC uint64_t coordinate_dr_coord(cube_t, const unsigned char *); |
| 9 | STATIC cube_t coordinate_dr_cube(uint64_t, const void *); | 9 | STATIC cube_t coordinate_dr_cube(uint64_t, const unsigned char *); |
| 10 | STATIC bool coordinate_dr_isnasty(uint64_t, const void *); | 10 | STATIC bool coordinate_dr_isnasty(uint64_t, const unsigned char *); |
| 11 | STATIC size_t coordinate_dr_gendata(void *); | 11 | STATIC size_t coordinate_dr_gendata(unsigned char *); |
| 12 | 12 | ||
| 13 | STATIC bool is_eoco_solvable(cube_t); | 13 | STATIC bool is_eoco_solvable(cube_t); |
| 14 | 14 | ||
| @@ -81,25 +81,25 @@ coordinate_dr_merge(cube_t c1, cube_t c2) | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | STATIC uint64_t | 83 | STATIC uint64_t |
| 84 | coordinate_dr_coord(cube_t cube, const void *data) | 84 | coordinate_dr_coord(cube_t cube, const unsigned char *data) |
| 85 | { | 85 | { |
| 86 | return coord_coord_generic(&coordinate_dr, cube, data); | 86 | return coord_coord_generic(&coordinate_dr, cube, data); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | STATIC cube_t | 89 | STATIC cube_t |
| 90 | coordinate_dr_cube(uint64_t i, const void *data) | 90 | coordinate_dr_cube(uint64_t i, const unsigned char *data) |
| 91 | { | 91 | { |
| 92 | return coord_cube_generic(&coordinate_dr, i, data); | 92 | return coord_cube_generic(&coordinate_dr, i, data); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | STATIC bool | 95 | STATIC bool |
| 96 | coordinate_dr_isnasty(uint64_t i, const void *data) | 96 | coordinate_dr_isnasty(uint64_t i, const unsigned char *data) |
| 97 | { | 97 | { |
| 98 | return coord_isnasty_generic(&coordinate_dr, i, data); | 98 | return coord_isnasty_generic(&coordinate_dr, i, data); |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | STATIC size_t | 101 | STATIC size_t |
| 102 | coordinate_dr_gendata(void *data) | 102 | coordinate_dr_gendata(unsigned char *data) |
| 103 | { | 103 | { |
| 104 | return coord_gendata_generic(&coordinate_dr, data); | 104 | return coord_gendata_generic(&coordinate_dr, data); |
| 105 | } | 105 | } |
diff --git a/src/solvers/coord/dreo.h b/src/solvers/coord/dreo.h index 37de0d3..2bc8cd1 100644 --- a/src/solvers/coord/dreo.h +++ b/src/solvers/coord/dreo.h | |||
| @@ -4,10 +4,10 @@ STATIC uint64_t coord_dresep_nosym(cube_t); | |||
| 4 | STATIC cube_t invcoord_dresep_nosym(uint64_t); | 4 | STATIC cube_t invcoord_dresep_nosym(uint64_t); |
| 5 | STATIC cube_t coordinate_dreo_merge(cube_t, cube_t); | 5 | STATIC cube_t coordinate_dreo_merge(cube_t, cube_t); |
| 6 | 6 | ||
| 7 | STATIC uint64_t coordinate_dreo_coord(cube_t, const void *); | 7 | STATIC uint64_t coordinate_dreo_coord(cube_t, const unsigned char *); |
| 8 | STATIC cube_t coordinate_dreo_cube(uint64_t, const void *); | 8 | STATIC cube_t coordinate_dreo_cube(uint64_t, const unsigned char *); |
| 9 | STATIC bool coordinate_dreo_isnasty(uint64_t, const void *); | 9 | STATIC bool coordinate_dreo_isnasty(uint64_t, const unsigned char *); |
| 10 | STATIC size_t coordinate_dreo_gendata(void *); | 10 | STATIC size_t coordinate_dreo_gendata(unsigned char *); |
| 11 | 11 | ||
| 12 | STATIC bool is_dreo_solvable(cube_t); | 12 | STATIC bool is_dreo_solvable(cube_t); |
| 13 | 13 | ||
| @@ -63,25 +63,25 @@ coordinate_dreo_merge(cube_t c1, cube_t c2) | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | STATIC uint64_t | 65 | STATIC uint64_t |
| 66 | coordinate_dreo_coord(cube_t cube, const void *data) | 66 | coordinate_dreo_coord(cube_t cube, const unsigned char *data) |
| 67 | { | 67 | { |
| 68 | return coord_coord_generic(&coordinate_dreo, cube, data); | 68 | return coord_coord_generic(&coordinate_dreo, cube, data); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | STATIC cube_t | 71 | STATIC cube_t |
| 72 | coordinate_dreo_cube(uint64_t i, const void *data) | 72 | coordinate_dreo_cube(uint64_t i, const unsigned char *data) |
| 73 | { | 73 | { |
| 74 | return coord_cube_generic(&coordinate_dreo, i, data); | 74 | return coord_cube_generic(&coordinate_dreo, i, data); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | STATIC bool | 77 | STATIC bool |
| 78 | coordinate_dreo_isnasty(uint64_t i, const void *data) | 78 | coordinate_dreo_isnasty(uint64_t i, const unsigned char *data) |
| 79 | { | 79 | { |
| 80 | return coord_isnasty_generic(&coordinate_dreo, i, data); | 80 | return coord_isnasty_generic(&coordinate_dreo, i, data); |
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | STATIC size_t | 83 | STATIC size_t |
| 84 | coordinate_dreo_gendata(void *data) | 84 | coordinate_dreo_gendata(unsigned char *data) |
| 85 | { | 85 | { |
| 86 | return coord_gendata_generic(&coordinate_dreo, data); | 86 | return coord_gendata_generic(&coordinate_dreo, data); |
| 87 | } | 87 | } |
diff --git a/src/solvers/coord/eo.h b/src/solvers/coord/eo.h index a0685c4..c8faaea 100644 --- a/src/solvers/coord/eo.h +++ b/src/solvers/coord/eo.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | STATIC uint64_t coordinate_eo_coord(cube_t, const void *); | 1 | STATIC uint64_t coordinate_eo_coord(cube_t, const unsigned char *); |
| 2 | STATIC cube_t coordinate_eo_cube(uint64_t, const void *); | 2 | STATIC cube_t coordinate_eo_cube(uint64_t, const unsigned char *); |
| 3 | STATIC bool coordinate_eo_isnasty(uint64_t, const void *); | 3 | STATIC bool coordinate_eo_isnasty(uint64_t, const unsigned char *); |
| 4 | STATIC size_t coordinate_eo_gendata(void *); | 4 | STATIC size_t coordinate_eo_gendata(unsigned char *); |
| 5 | STATIC bool is_eo_even(cube_t); | 5 | STATIC bool is_eo_even(cube_t); |
| 6 | 6 | ||
| 7 | STATIC coord_t coordinate_eo = { | 7 | STATIC coord_t coordinate_eo = { |
| @@ -24,13 +24,13 @@ STATIC coord_t coordinate_eo = { | |||
| 24 | }; | 24 | }; |
| 25 | 25 | ||
| 26 | STATIC uint64_t | 26 | STATIC uint64_t |
| 27 | coordinate_eo_coord(cube_t c, const void *data) | 27 | coordinate_eo_coord(cube_t c, const unsigned char *data) |
| 28 | { | 28 | { |
| 29 | return (uint64_t)coord_eo(c); | 29 | return (uint64_t)coord_eo(c); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | STATIC cube_t | 32 | STATIC cube_t |
| 33 | coordinate_eo_cube(uint64_t c, const void *data) | 33 | coordinate_eo_cube(uint64_t c, const unsigned char *data) |
| 34 | { | 34 | { |
| 35 | cube_t cube = SOLVED_CUBE; | 35 | cube_t cube = SOLVED_CUBE; |
| 36 | set_eo(&cube, (int64_t)c); | 36 | set_eo(&cube, (int64_t)c); |
| @@ -38,13 +38,13 @@ coordinate_eo_cube(uint64_t c, const void *data) | |||
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | STATIC bool | 40 | STATIC bool |
| 41 | coordinate_eo_isnasty(uint64_t c, const void *data) | 41 | coordinate_eo_isnasty(uint64_t c, const unsigned char *data) |
| 42 | { | 42 | { |
| 43 | return false; | 43 | return false; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | STATIC size_t | 46 | STATIC size_t |
| 47 | coordinate_eo_gendata(void *data) | 47 | coordinate_eo_gendata(unsigned char *data) |
| 48 | { | 48 | { |
| 49 | return 0; | 49 | return 0; |
| 50 | } | 50 | } |
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index ae7b39e..7a974f8 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,21 +1,21 @@ | |||
| 1 | STATIC size_t gendata_coord(const coord_t [static 1], void *); | 1 | STATIC size_t gendata_coord(const coord_t [static 1], unsigned char *); |
| 2 | STATIC int64_t gendata_coord_dispatch(const char *, void *); | 2 | STATIC int64_t gendata_coord_dispatch(const char *, unsigned char *); |
| 3 | STATIC tableinfo_t genptable_coord( | 3 | STATIC tableinfo_t genptable_coord( |
| 4 | const coord_t [static 1], const void *, uint8_t *); | 4 | const coord_t [static 1], const unsigned char *, unsigned char *); |
| 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); | 5 | STATIC bool switch_to_fromnew(uint64_t, uint64_t, uint64_t); |
| 6 | STATIC uint64_t genptable_coord_fillneighbors( | 6 | STATIC uint64_t genptable_coord_fillneighbors(const coord_t [static 1], |
| 7 | const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *); | 7 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 8 | STATIC uint64_t genptable_coord_fillfromnew( | 8 | STATIC uint64_t genptable_coord_fillfromnew(const coord_t [static 1], |
| 9 | const coord_t [static 1], const void *, uint64_t, uint8_t, uint8_t *); | 9 | const unsigned char *, uint64_t, uint8_t, unsigned char *); |
| 10 | STATIC void getdistribution_coord( | 10 | STATIC void getdistribution_coord(const unsigned char *, const char *, |
| 11 | const uint8_t *, const char *, uint64_t [static INFO_DISTRIBUTION_LEN]); | 11 | uint64_t [static INFO_DISTRIBUTION_LEN]); |
| 12 | STATIC uint8_t get_coord_pval( | 12 | STATIC uint8_t get_coord_pval( |
| 13 | const coord_t [static 1], const uint8_t *, uint64_t); | 13 | const coord_t [static 1], const unsigned char *, uint64_t); |
| 14 | STATIC void set_coord_pval( | 14 | STATIC void set_coord_pval( |
| 15 | const coord_t [static 1], uint8_t *, uint64_t, uint8_t); | 15 | const coord_t [static 1], unsigned char *, uint64_t, uint8_t); |
| 16 | 16 | ||
| 17 | STATIC int64_t | 17 | STATIC int64_t |
| 18 | gendata_coord_dispatch(const char *coordstr, void *buf) | 18 | gendata_coord_dispatch(const char *coordstr, unsigned char *buf) |
| 19 | { | 19 | { |
| 20 | coord_t *coord; | 20 | coord_t *coord; |
| 21 | 21 | ||
| @@ -30,14 +30,14 @@ gendata_coord_dispatch(const char *coordstr, void *buf) | |||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | STATIC size_t | 32 | STATIC size_t |
| 33 | gendata_coord(const coord_t coord[static 1], void *buf) | 33 | gendata_coord(const coord_t coord[static 1], unsigned char *buf) |
| 34 | { | 34 | { |
| 35 | uint64_t coord_dsize, tablesize, ninfo; | 35 | uint64_t coord_dsize, tablesize, ninfo; |
| 36 | void *pruningbuf, *coord_data; | 36 | unsigned char *pruningbuf, *coord_data; |
| 37 | uint8_t *table; | 37 | unsigned char *table; |
| 38 | tableinfo_t coord_data_info, pruning_info; | 38 | tableinfo_t coord_data_info, pruning_info; |
| 39 | 39 | ||
| 40 | coord_data = buf == NULL ? NULL : ((uint8_t *)buf) + INFOSIZE; | 40 | coord_data = buf == NULL ? NULL : buf + INFOSIZE; |
| 41 | coord_dsize = coord->gendata(coord_data); | 41 | coord_dsize = coord->gendata(coord_data); |
| 42 | if (coord_dsize == SIZE_MAX) | 42 | if (coord_dsize == SIZE_MAX) |
| 43 | goto gendata_coord_error; | 43 | goto gendata_coord_error; |
| @@ -69,12 +69,12 @@ gendata_coord(const coord_t coord[static 1], void *buf) | |||
| 69 | 69 | ||
| 70 | writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); | 70 | writetableinfo(&coord_data_info, INFOSIZE + coord_dsize, buf); |
| 71 | 71 | ||
| 72 | pruningbuf = ((uint8_t *)buf) + INFOSIZE + coord_dsize; | 72 | pruningbuf = buf + INFOSIZE + coord_dsize; |
| 73 | } else { | 73 | } else { |
| 74 | pruningbuf = buf; | 74 | pruningbuf = buf; |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | table = ((uint8_t *)pruningbuf) + INFOSIZE; | 77 | table = pruningbuf + INFOSIZE; |
| 78 | pruning_info = genptable_coord(coord, coord_data, table); | 78 | pruning_info = genptable_coord(coord, coord_data, table); |
| 79 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); | 79 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); |
| 80 | 80 | ||
| @@ -89,8 +89,8 @@ gendata_coord_error: | |||
| 89 | STATIC tableinfo_t | 89 | STATIC tableinfo_t |
| 90 | genptable_coord( | 90 | genptable_coord( |
| 91 | const coord_t coord[static 1], | 91 | const coord_t coord[static 1], |
| 92 | const void *data, | 92 | const unsigned char *data, |
| 93 | uint8_t *table | 93 | unsigned char *table |
| 94 | ) | 94 | ) |
| 95 | { | 95 | { |
| 96 | uint64_t tablesize, i, d, tot, t, nm; | 96 | uint64_t tablesize, i, d, tot, t, nm; |
| @@ -161,10 +161,10 @@ switch_to_fromnew(uint64_t done, uint64_t max, uint64_t nm) | |||
| 161 | STATIC uint64_t | 161 | STATIC uint64_t |
| 162 | genptable_coord_fillneighbors( | 162 | genptable_coord_fillneighbors( |
| 163 | const coord_t coord[static 1], | 163 | const coord_t coord[static 1], |
| 164 | const void *data, | 164 | const unsigned char *data, |
| 165 | uint64_t i, | 165 | uint64_t i, |
| 166 | uint8_t d, | 166 | uint8_t d, |
| 167 | uint8_t *table | 167 | unsigned char *table |
| 168 | ) | 168 | ) |
| 169 | { | 169 | { |
| 170 | bool isnasty; | 170 | bool isnasty; |
| @@ -198,10 +198,10 @@ genptable_coord_fillneighbors( | |||
| 198 | STATIC uint64_t | 198 | STATIC uint64_t |
| 199 | genptable_coord_fillfromnew( | 199 | genptable_coord_fillfromnew( |
| 200 | const coord_t coord[static 1], | 200 | const coord_t coord[static 1], |
| 201 | const void *data, | 201 | const unsigned char *data, |
| 202 | uint64_t i, | 202 | uint64_t i, |
| 203 | uint8_t d, | 203 | uint8_t d, |
| 204 | uint8_t *table | 204 | unsigned char *table |
| 205 | ) | 205 | ) |
| 206 | { | 206 | { |
| 207 | bool found; | 207 | bool found; |
| @@ -251,7 +251,7 @@ genptable_coord_fillfromnew( | |||
| 251 | 251 | ||
| 252 | STATIC void | 252 | STATIC void |
| 253 | getdistribution_coord( | 253 | getdistribution_coord( |
| 254 | const uint8_t *table, | 254 | const unsigned char *table, |
| 255 | const char *coord, | 255 | const char *coord, |
| 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] | 256 | uint64_t distr[static INFO_DISTRIBUTION_LEN] |
| 257 | ) | 257 | ) |
| @@ -274,7 +274,7 @@ getdistribution_coord( | |||
| 274 | STATIC uint8_t | 274 | STATIC uint8_t |
| 275 | get_coord_pval( | 275 | get_coord_pval( |
| 276 | const coord_t coord[static 1], | 276 | const coord_t coord[static 1], |
| 277 | const uint8_t *table, | 277 | const unsigned char *table, |
| 278 | uint64_t i | 278 | uint64_t i |
| 279 | ) | 279 | ) |
| 280 | { | 280 | { |
| @@ -284,7 +284,7 @@ get_coord_pval( | |||
| 284 | STATIC void | 284 | STATIC void |
| 285 | set_coord_pval( | 285 | set_coord_pval( |
| 286 | const coord_t coord[static 1], | 286 | const coord_t coord[static 1], |
| 287 | uint8_t *table, | 287 | unsigned char *table, |
| 288 | uint64_t i, | 288 | uint64_t i, |
| 289 | uint8_t val | 289 | uint8_t val |
| 290 | ) | 290 | ) |
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index 072aa27..fb996ac 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -8,16 +8,16 @@ typedef struct { | |||
| 8 | uint8_t nissflag; | 8 | uint8_t nissflag; |
| 9 | bool lastisnormal; | 9 | bool lastisnormal; |
| 10 | coord_t *coord; | 10 | coord_t *coord; |
| 11 | const void *coord_data; | 11 | const unsigned char *coord_data; |
| 12 | const uint8_t *ptable; | 12 | const unsigned char *ptable; |
| 13 | } dfsarg_solve_coord_t; | 13 | } dfsarg_solve_coord_t; |
| 14 | 14 | ||
| 15 | STATIC int64_t solve_coord(cube_t, coord_t [static 1], uint8_t, uint8_t, | 15 | STATIC int64_t solve_coord(cube_t, coord_t [static 1], uint8_t, uint8_t, |
| 16 | uint8_t, uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, const void *, | 16 | uint8_t, uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, |
| 17 | size_t n, char [n]); | 17 | const unsigned char *, size_t n, char [n]); |
| 18 | STATIC int64_t solve_coord_dispatch(cube_t, const char *, uint8_t, uint8_t, | 18 | STATIC int64_t solve_coord_dispatch(cube_t, const char *, uint8_t, uint8_t, |
| 19 | uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, const void *, size_t n, | 19 | uint8_t, uint64_t, uint8_t, uint8_t, uint64_t, const unsigned char *, |
| 20 | char [n]); | 20 | size_t n, char [n]); |
| 21 | STATIC bool coord_solution_admissible(const dfsarg_solve_coord_t [static 1]); | 21 | STATIC bool coord_solution_admissible(const dfsarg_solve_coord_t [static 1]); |
| 22 | STATIC bool solve_coord_dfs_stop(const dfsarg_solve_coord_t [static 1]); | 22 | STATIC bool solve_coord_dfs_stop(const dfsarg_solve_coord_t [static 1]); |
| 23 | STATIC bool coord_continue_onnormal(const dfsarg_solve_coord_t [static 1]); | 23 | STATIC bool coord_continue_onnormal(const dfsarg_solve_coord_t [static 1]); |
| @@ -209,7 +209,7 @@ solve_coord_dispatch( | |||
| 209 | uint8_t optimal, | 209 | uint8_t optimal, |
| 210 | uint8_t threads, | 210 | uint8_t threads, |
| 211 | uint64_t data_size, | 211 | uint64_t data_size, |
| 212 | const void *data, | 212 | const unsigned char *data, |
| 213 | size_t solutions_size, | 213 | size_t solutions_size, |
| 214 | char sols[solutions_size] | 214 | char sols[solutions_size] |
| 215 | ) | 215 | ) |
| @@ -248,7 +248,7 @@ solve_coord( | |||
| 248 | uint8_t optimal, | 248 | uint8_t optimal, |
| 249 | uint8_t threads, | 249 | uint8_t threads, |
| 250 | uint64_t data_size, | 250 | uint64_t data_size, |
| 251 | const void *data, | 251 | const unsigned char *data, |
| 252 | size_t solutions_size, | 252 | size_t solutions_size, |
| 253 | char sols[solutions_size] | 253 | char sols[solutions_size] |
| 254 | ) | 254 | ) |
| @@ -257,8 +257,8 @@ solve_coord( | |||
| 257 | uint8_t t; | 257 | uint8_t t; |
| 258 | int64_t ndepth; | 258 | int64_t ndepth; |
| 259 | cube_t c; | 259 | cube_t c; |
| 260 | const void *coord_data; | 260 | const unsigned char *coord_data; |
| 261 | const uint8_t *ptable; | 261 | const unsigned char *ptable; |
| 262 | dfsarg_solve_coord_t arg; | 262 | dfsarg_solve_coord_t arg; |
| 263 | tableinfo_t info; | 263 | tableinfo_t info; |
| 264 | solution_moves_t solution_moves; | 264 | solution_moves_t solution_moves; |
| @@ -280,11 +280,11 @@ solve_coord( | |||
| 280 | if (info.type == TABLETYPE_PRUNING) { | 280 | if (info.type == TABLETYPE_PRUNING) { |
| 281 | /* Only the pruning table */ | 281 | /* Only the pruning table */ |
| 282 | coord_data = NULL; | 282 | coord_data = NULL; |
| 283 | ptable = (uint8_t *)data + INFOSIZE; | 283 | ptable = data + INFOSIZE; |
| 284 | } else { | 284 | } else { |
| 285 | /* Coordinate has extra data */ | 285 | /* Coordinate has extra data */ |
| 286 | coord_data = (uint8_t *)data + INFOSIZE; | 286 | coord_data = data + INFOSIZE; |
| 287 | ptable = (uint8_t *)data + info.next + INFOSIZE; | 287 | ptable = data + info.next + INFOSIZE; |
| 288 | } | 288 | } |
| 289 | 289 | ||
| 290 | solution_moves_reset(&solution_moves); | 290 | solution_moves_reset(&solution_moves); |
diff --git a/src/solvers/coord/types_macros.h b/src/solvers/coord/types_macros.h index 84ed8eb..2767dcc 100644 --- a/src/solvers/coord/types_macros.h +++ b/src/solvers/coord/types_macros.h | |||
| @@ -16,10 +16,10 @@ | |||
| 16 | 16 | ||
| 17 | typedef struct { | 17 | typedef struct { |
| 18 | const char name[255]; | 18 | const char name[255]; |
| 19 | uint64_t (*coord)(cube_t, const void *); | 19 | uint64_t (*coord)(cube_t, const unsigned char *); |
| 20 | cube_t (*cube)(uint64_t, const void *); | 20 | cube_t (*cube)(uint64_t, const unsigned char *); |
| 21 | bool (*isnasty)(uint64_t, const void *); | 21 | bool (*isnasty)(uint64_t, const unsigned char *); |
| 22 | size_t (*gendata)(void *); | 22 | size_t (*gendata)(unsigned char *); |
| 23 | uint64_t max; | 23 | uint64_t max; |
| 24 | uint32_t moves_mask; | 24 | uint32_t moves_mask; |
| 25 | uint64_t trans_mask; | 25 | uint64_t trans_mask; |
