diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-09 07:43:37 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-09 07:43:37 +0100 |
| commit | 11e6aeeaf5f08839c6effb8f68710081acf491bf (patch) | |
| tree | 8aab442a637fd35bb457946926fd9bc749ee0467 /src | |
| parent | 110e079f81277b40ec76be0b86b074a632496109 (diff) | |
| download | nissy-core-11e6aeeaf5f08839c6effb8f68710081acf491bf.tar.gz nissy-core-11e6aeeaf5f08839c6effb8f68710081acf491bf.zip | |
Working (?) version of coordinate solver
Diffstat (limited to 'src')
| -rw-r--r-- | src/nissy.c | 21 | ||||
| -rw-r--r-- | src/nissy.h | 4 | ||||
| -rw-r--r-- | src/solvers/coord/common.h (renamed from src/solvers/coord/coord_common.h) | 0 | ||||
| -rw-r--r-- | src/solvers/coord/coord.h | 4 | ||||
| -rw-r--r-- | src/solvers/coord/gendata.h | 30 | ||||
| -rw-r--r-- | src/solvers/coord/solve.h | 69 | ||||
| -rw-r--r-- | src/solvers/coord/types_macros.h (renamed from src/solvers/coord/coord_types_macros.h) | 0 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 7 |
8 files changed, 91 insertions, 44 deletions
diff --git a/src/nissy.c b/src/nissy.c index ffda4b3..ed1d3f4 100644 --- a/src/nissy.c +++ b/src/nissy.c | |||
| @@ -451,14 +451,16 @@ nissy_gendata_unsafe( | |||
| 451 | return NISSY_ERROR_DATA; | 451 | return NISSY_ERROR_DATA; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | arg.buf_size = data_size; | ||
| 455 | arg.buf = data; | ||
| 456 | if (!strncmp(solver, "h48", 3)) { | 454 | if (!strncmp(solver, "h48", 3)) { |
| 455 | arg.buf_size = data_size; | ||
| 456 | arg.buf = data; | ||
| 457 | parse_ret = parse_h48_solver(solver, &arg.h, &arg.k); | 457 | parse_ret = parse_h48_solver(solver, &arg.h, &arg.k); |
| 458 | arg.maxdepth = 20; | 458 | arg.maxdepth = 20; |
| 459 | if (parse_ret != NISSY_OK) | 459 | if (parse_ret != NISSY_OK) |
| 460 | return parse_ret; | 460 | return parse_ret; |
| 461 | return gendata_h48(&arg); | 461 | return gendata_h48(&arg); |
| 462 | } else if (!strncmp(solver, "coord_", 6)) { | ||
| 463 | return gendata_coord_dispatch(solver+6, data); | ||
| 462 | } else { | 464 | } else { |
| 463 | LOG("gendata: unknown solver %s\n", solver); | 465 | LOG("gendata: unknown solver %s\n", solver); |
| 464 | return NISSY_ERROR_INVALID_SOLVER; | 466 | return NISSY_ERROR_INVALID_SOLVER; |
| @@ -501,6 +503,7 @@ long long | |||
| 501 | nissy_solve( | 503 | nissy_solve( |
| 502 | const char cube[static NISSY_SIZE_B32], | 504 | const char cube[static NISSY_SIZE_B32], |
| 503 | const char *solver, | 505 | const char *solver, |
| 506 | const char *options, | ||
| 504 | unsigned nissflag, | 507 | unsigned nissflag, |
| 505 | unsigned minmoves, | 508 | unsigned minmoves, |
| 506 | unsigned maxmoves, | 509 | unsigned maxmoves, |
| @@ -536,6 +539,8 @@ nissy_solve( | |||
| 536 | return NISSY_ERROR_UNSOLVABLE_CUBE; | 539 | return NISSY_ERROR_UNSOLVABLE_CUBE; |
| 537 | } | 540 | } |
| 538 | 541 | ||
| 542 | /* TODO: checks for minmoves, maxmoves, nissflag */ | ||
| 543 | |||
| 539 | if (maxsols == 0) { | 544 | if (maxsols == 0) { |
| 540 | LOG("solve: 'maxsols' is 0, returning no solution\n"); | 545 | LOG("solve: 'maxsols' is 0, returning no solution\n"); |
| 541 | return 0; | 546 | return 0; |
| @@ -562,11 +567,15 @@ nissy_solve( | |||
| 562 | 567 | ||
| 563 | if (!strncmp(solver, "h48", 3)) { | 568 | if (!strncmp(solver, "h48", 3)) { |
| 564 | parse_ret = parse_h48_solver(solver, &h, &k); | 569 | parse_ret = parse_h48_solver(solver, &h, &k); |
| 565 | if (parse_ret == NISSY_OK) | 570 | if (parse_ret != NISSY_OK) |
| 566 | return solve_h48(c, minmoves, maxmoves, maxsols, opt, | ||
| 567 | t, data_size, data, sols_size, sols, stats); | ||
| 568 | else | ||
| 569 | return parse_ret; | 571 | return parse_ret; |
| 572 | /* TODO give warning if options is not NULL or empty? */ | ||
| 573 | return solve_h48(c, minmoves, maxmoves, maxsols, | ||
| 574 | opt, t, data_size, data, sols_size, sols, stats); | ||
| 575 | } else if (!strncmp(solver, "coord_", 6)) { | ||
| 576 | return solve_coord_dispatch(c, solver + 6, options, nissflag, | ||
| 577 | minmoves, maxmoves, maxsols, opt, t, data_size, data, | ||
| 578 | sols_size, sols); | ||
| 570 | } else { | 579 | } else { |
| 571 | LOG("solve: unknown solver '%s'\n", solver); | 580 | LOG("solve: unknown solver '%s'\n", solver); |
| 572 | return NISSY_ERROR_INVALID_SOLVER; | 581 | return NISSY_ERROR_INVALID_SOLVER; |
diff --git a/src/nissy.h b/src/nissy.h index 6c5a3e6..9c26292 100644 --- a/src/nissy.h +++ b/src/nissy.h | |||
| @@ -257,6 +257,9 @@ Solve the given cube using the given solver and options. | |||
| 257 | Parameters: | 257 | Parameters: |
| 258 | cube - The cube to solver, in B32 format. | 258 | cube - The cube to solver, in B32 format. |
| 259 | solver - The name of the solver. | 259 | solver - The name of the solver. |
| 260 | options - Extra options for the solver. Some solver require additional | ||
| 261 | parameters, some do not. For example, a coordinate solver | ||
| 262 | may require an "axis" (UD, FB, RL) as a parameter. | ||
| 260 | nissflag - The flags for NISS (linear, inverse, mixed, or combinations). | 263 | nissflag - The flags for NISS (linear, inverse, mixed, or combinations). |
| 261 | minmoves - The minimum number of moves for a solution. | 264 | minmoves - The minimum number of moves for a solution. |
| 262 | maxmoves - The maximum number of moves for a solution. | 265 | maxmoves - The maximum number of moves for a solution. |
| @@ -290,6 +293,7 @@ long long | |||
| 290 | nissy_solve( | 293 | nissy_solve( |
| 291 | const char cube[static NISSY_SIZE_B32], | 294 | const char cube[static NISSY_SIZE_B32], |
| 292 | const char *solver, | 295 | const char *solver, |
| 296 | const char *options, | ||
| 293 | unsigned nissflag, | 297 | unsigned nissflag, |
| 294 | unsigned minmoves, | 298 | unsigned minmoves, |
| 295 | unsigned maxmoves, | 299 | unsigned maxmoves, |
diff --git a/src/solvers/coord/coord_common.h b/src/solvers/coord/common.h index d827665..d827665 100644 --- a/src/solvers/coord/coord_common.h +++ b/src/solvers/coord/common.h | |||
diff --git a/src/solvers/coord/coord.h b/src/solvers/coord/coord.h index fc241cb..6ca68c5 100644 --- a/src/solvers/coord/coord.h +++ b/src/solvers/coord/coord.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #include "coord_types_macros.h" | 1 | #include "types_macros.h" |
| 2 | #include "eo.h" | 2 | #include "eo.h" |
| 3 | #include "coord_common.h" | 3 | #include "common.h" |
| 4 | #include "gendata.h" | 4 | #include "gendata.h" |
| 5 | #include "solve.h" | 5 | #include "solve.h" |
diff --git a/src/solvers/coord/gendata.h b/src/solvers/coord/gendata.h index 3d385e9..d366466 100644 --- a/src/solvers/coord/gendata.h +++ b/src/solvers/coord/gendata.h | |||
| @@ -1,26 +1,26 @@ | |||
| 1 | STATIC size_t gendata_coordinate(const coord_t *, void *); | 1 | STATIC size_t gendata_coord(const coord_t *, void *); |
| 2 | STATIC size_t gendata_coordinate_name(const char *, void *); | 2 | STATIC int64_t gendata_coord_dispatch(const char *, void *); |
| 3 | STATIC tableinfo_t genptable_coordinate(const coord_t *, const void *, uint8_t *); | 3 | STATIC tableinfo_t genptable_coord(const coord_t *, const void *, uint8_t *); |
| 4 | STATIC uint8_t get_coord_pval(const coord_t *, const uint8_t *, uint64_t); | 4 | STATIC uint8_t get_coord_pval(const coord_t *, const uint8_t *, uint64_t); |
| 5 | STATIC void set_coord_pval(const coord_t *, uint8_t *, uint64_t, uint8_t); | 5 | STATIC void set_coord_pval(const coord_t *, uint8_t *, uint64_t, uint8_t); |
| 6 | 6 | ||
| 7 | STATIC size_t | 7 | STATIC int64_t |
| 8 | gendata_coordinate_name(const char *name, void *buf) | 8 | gendata_coord_dispatch(const char *coordstr, void *buf) |
| 9 | { | 9 | { |
| 10 | coord_t *coord; | 10 | coord_t *coord; |
| 11 | 11 | ||
| 12 | coord = parse_coord(name, strlen(name)); | 12 | coord = parse_coord(coordstr, strlen(coordstr)); |
| 13 | |||
| 13 | if (coord == NULL) { | 14 | if (coord == NULL) { |
| 14 | LOG("Cannot generate data for coordinate '%s': not found\n", | 15 | LOG("Could not parse coordinate '%s'\n", coord); |
| 15 | name); | 16 | return NISSY_ERROR_INVALID_SOLVER; |
| 16 | return 0; | ||
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | return gendata_coordinate(coord, buf); | 19 | return (int64_t)gendata_coord(coord, buf); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | STATIC size_t | 22 | STATIC size_t |
| 23 | gendata_coordinate(const coord_t *coord, void *buf) | 23 | gendata_coord(const coord_t *coord, void *buf) |
| 24 | { | 24 | { |
| 25 | uint64_t coord_dsize, tablesize, ninfo; | 25 | uint64_t coord_dsize, tablesize, ninfo; |
| 26 | void *pruningbuf, *coord_data; | 26 | void *pruningbuf, *coord_data; |
| @@ -33,7 +33,7 @@ gendata_coordinate(const coord_t *coord, void *buf) | |||
| 33 | tablesize = DIV_ROUND_UP(coord->max, 2); | 33 | tablesize = DIV_ROUND_UP(coord->max, 2); |
| 34 | 34 | ||
| 35 | if (buf == NULL) | 35 | if (buf == NULL) |
| 36 | goto gendata_coordinate_return_size; | 36 | goto gendata_coord_return_size; |
| 37 | 37 | ||
| 38 | if (ninfo == 2) { | 38 | if (ninfo == 2) { |
| 39 | coord_data_info = (tableinfo_t) { | 39 | coord_data_info = (tableinfo_t) { |
| @@ -62,15 +62,15 @@ gendata_coordinate(const coord_t *coord, void *buf) | |||
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | table = ((uint8_t *)pruningbuf) + INFOSIZE; | 64 | table = ((uint8_t *)pruningbuf) + INFOSIZE; |
| 65 | pruning_info = genptable_coordinate(coord, coord_data, table); | 65 | pruning_info = genptable_coord(coord, coord_data, table); |
| 66 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); | 66 | writetableinfo(&pruning_info, INFOSIZE + tablesize, pruningbuf); |
| 67 | 67 | ||
| 68 | gendata_coordinate_return_size: | 68 | gendata_coord_return_size: |
| 69 | return ninfo * INFOSIZE + coord_dsize + tablesize; | 69 | return ninfo * INFOSIZE + coord_dsize + tablesize; |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | STATIC tableinfo_t | 72 | STATIC tableinfo_t |
| 73 | genptable_coordinate(const coord_t *coord, const void *data, uint8_t *table) | 73 | genptable_coord(const coord_t *coord, const void *data, uint8_t *table) |
| 74 | { | 74 | { |
| 75 | uint64_t tablesize, i, j, d, tot; | 75 | uint64_t tablesize, i, j, d, tot; |
| 76 | tableinfo_t info; | 76 | tableinfo_t info; |
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index e954aac..190ac1f 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -20,8 +20,9 @@ typedef struct { | |||
| 20 | 20 | ||
| 21 | STATIC int64_t solve_coord(cube_t, coord_t *, uint8_t, uint8_t, uint8_t, | 21 | STATIC int64_t solve_coord(cube_t, coord_t *, uint8_t, uint8_t, uint8_t, |
| 22 | uint8_t, uint64_t, int, int, uint64_t, const void *, uint64_t, char *); | 22 | uint8_t, uint64_t, int, int, uint64_t, const void *, uint64_t, char *); |
| 23 | STATIC int64_t solve_coord_dispatch(cube_t, const char *, uint8_t, uint8_t, | 23 | STATIC int64_t solve_coord_dispatch(cube_t, const char *, const char *, |
| 24 | uint8_t, uint64_t, int, int, uint64_t, const void *, uint64_t, char *); | 24 | uint8_t, uint8_t, uint8_t, uint64_t, int, int, uint64_t, const void *, |
| 25 | uint64_t, char *); | ||
| 25 | STATIC bool solve_coord_appendchar(char *, uint64_t, uint64_t *, char); | 26 | STATIC bool solve_coord_appendchar(char *, uint64_t, uint64_t *, char); |
| 26 | STATIC int64_t solve_coord_appendsolution(dfsarg_solve_coord_t *); | 27 | STATIC int64_t solve_coord_appendsolution(dfsarg_solve_coord_t *); |
| 27 | STATIC int64_t solve_coord_dfs(dfsarg_solve_coord_t *); | 28 | STATIC int64_t solve_coord_dfs(dfsarg_solve_coord_t *); |
| @@ -29,7 +30,9 @@ STATIC int64_t solve_coord_dfs(dfsarg_solve_coord_t *); | |||
| 29 | STATIC int64_t | 30 | STATIC int64_t |
| 30 | solve_coord_appendsolution(dfsarg_solve_coord_t *arg) | 31 | solve_coord_appendsolution(dfsarg_solve_coord_t *arg) |
| 31 | { | 32 | { |
| 32 | uint8_t i, t, tmoves[MAXLEN_COORDSOL]; | 33 | uint8_t i, t, l, tmoves[MAXLEN_COORDSOL]; |
| 34 | char *m; | ||
| 35 | int64_t strl; | ||
| 33 | 36 | ||
| 34 | if (*arg->nsols >= arg->maxsolutions || | 37 | if (*arg->nsols >= arg->maxsolutions || |
| 35 | arg->nmoves > *arg->shortest_sol + arg->optimal) | 38 | arg->nmoves > *arg->shortest_sol + arg->optimal) |
| @@ -41,9 +44,26 @@ solve_coord_appendsolution(dfsarg_solve_coord_t *arg) | |||
| 41 | for (i = 0; i < arg->nmoves; i++) | 44 | for (i = 0; i < arg->nmoves; i++) |
| 42 | tmoves[i] = transform_move(arg->moves[i], t); | 45 | tmoves[i] = transform_move(arg->moves[i], t); |
| 43 | 46 | ||
| 44 | /* TODO append tmoves[] */ | 47 | l = arg->solutions_size - *arg->solutions_used; |
| 48 | m = *arg->solutions + *arg->solutions_used; | ||
| 49 | strl = writemoves(tmoves, arg->nmoves, l, m); | ||
| 50 | if (strl < 0) | ||
| 51 | goto solve_coord_appendsolution_error; | ||
| 52 | |||
| 53 | *arg->solutions_used += MAX(0, strl-1); | ||
| 54 | |||
| 55 | if (!solve_coord_appendchar( | ||
| 56 | *arg->solutions, arg->solutions_size, arg->solutions_used, '\n')) | ||
| 57 | goto solve_coord_appendsolution_error; | ||
| 58 | |||
| 59 | (*arg->nsols)++; | ||
| 60 | *arg->shortest_sol = MIN(*arg->shortest_sol, arg->nmoves); | ||
| 45 | 61 | ||
| 46 | return 1; | 62 | return 1; |
| 63 | |||
| 64 | solve_coord_appendsolution_error: | ||
| 65 | LOG("Could not append solution to buffer: size too small\n"); | ||
| 66 | return NISSY_ERROR_BUFFER_SIZE; | ||
| 47 | } | 67 | } |
| 48 | 68 | ||
| 49 | STATIC bool | 69 | STATIC bool |
| @@ -61,8 +81,11 @@ solve_coord_appendchar(char *s, uint64_t s_size, uint64_t *s_used, char c) | |||
| 61 | STATIC int64_t | 81 | STATIC int64_t |
| 62 | solve_coord_dfs(dfsarg_solve_coord_t *arg) | 82 | solve_coord_dfs(dfsarg_solve_coord_t *arg) |
| 63 | { | 83 | { |
| 84 | uint8_t m, pval; | ||
| 85 | uint32_t mm; | ||
| 64 | uint64_t coord; | 86 | uint64_t coord; |
| 65 | uint8_t pval; | 87 | int64_t n, ret; |
| 88 | cube_t backup_cube; | ||
| 66 | 89 | ||
| 67 | coord = arg->coord->coord(arg->cube, arg->coord_data); | 90 | coord = arg->coord->coord(arg->cube, arg->coord_data); |
| 68 | 91 | ||
| @@ -76,8 +99,23 @@ solve_coord_dfs(dfsarg_solve_coord_t *arg) | |||
| 76 | if (arg->nmoves + pval > arg->depth) | 99 | if (arg->nmoves + pval > arg->depth) |
| 77 | return 0; | 100 | return 0; |
| 78 | 101 | ||
| 79 | /* TODO recursive call */ | 102 | backup_cube = arg->cube; |
| 80 | /* Is allowednextmove available here? */ | 103 | |
| 104 | ret = 0; | ||
| 105 | mm = allowednextmove_mask(arg->moves, arg->nmoves); | ||
| 106 | arg->nmoves++; | ||
| 107 | for (m = 0; m < 18; m++) { | ||
| 108 | if (!(mm & (1 << m))) | ||
| 109 | continue; | ||
| 110 | |||
| 111 | arg->moves[arg->nmoves-1] = m; | ||
| 112 | arg->cube = move(backup_cube, m); | ||
| 113 | n = solve_coord_dfs(arg); | ||
| 114 | if (n < 0) | ||
| 115 | return n; | ||
| 116 | ret += n; | ||
| 117 | } | ||
| 118 | arg->nmoves--; | ||
| 81 | 119 | ||
| 82 | return 0; | 120 | return 0; |
| 83 | } | 121 | } |
| @@ -85,7 +123,8 @@ solve_coord_dfs(dfsarg_solve_coord_t *arg) | |||
| 85 | STATIC int64_t | 123 | STATIC int64_t |
| 86 | solve_coord_dispatch( | 124 | solve_coord_dispatch( |
| 87 | cube_t cube, | 125 | cube_t cube, |
| 88 | const char *coord_axis, | 126 | const char *coordstr, |
| 127 | const char *options, | ||
| 89 | uint8_t nissflag, | 128 | uint8_t nissflag, |
| 90 | uint8_t minmoves, | 129 | uint8_t minmoves, |
| 91 | uint8_t maxmoves, | 130 | uint8_t maxmoves, |
| @@ -98,23 +137,19 @@ solve_coord_dispatch( | |||
| 98 | char *sols | 137 | char *sols |
| 99 | ) | 138 | ) |
| 100 | { | 139 | { |
| 101 | int i, n; | ||
| 102 | coord_t *coord; | 140 | coord_t *coord; |
| 103 | uint8_t axis; | 141 | uint8_t axis; |
| 104 | 142 | ||
| 105 | n = strlen(coord_axis); | 143 | coord = parse_coord(coordstr, strlen(coordstr)); |
| 106 | for (i = 0; coord_axis[i] != ' ' && coord_axis[i] != '\0'; i++) ; | 144 | axis = parse_axis(options, strlen(options)); |
| 107 | |||
| 108 | coord = parse_coord(coord_axis, i); | ||
| 109 | axis = parse_axis(coord_axis + i + 1, n - i - 1); | ||
| 110 | 145 | ||
| 111 | if (coord == NULL) { | 146 | if (coord == NULL) { |
| 112 | LOG("Could not parse coordinate '%s'\n", coord_axis); | 147 | LOG("Could not parse coordinate '%s'\n", coordstr); |
| 113 | return NISSY_ERROR_INVALID_SOLVER; | 148 | return NISSY_ERROR_INVALID_SOLVER; |
| 114 | } | 149 | } |
| 115 | 150 | ||
| 116 | if (axis == UINT8_ERROR) { | 151 | if (axis == UINT8_ERROR) { |
| 117 | LOG("Could not parse axis from '%s'\n", coord_axis); | 152 | LOG("Could not parse axis from options '%s'\n", options); |
| 118 | return NISSY_ERROR_INVALID_SOLVER; | 153 | return NISSY_ERROR_INVALID_SOLVER; |
| 119 | } | 154 | } |
| 120 | 155 | ||
| @@ -165,8 +200,8 @@ solve_coord( | |||
| 165 | nsols = 0; | 200 | nsols = 0; |
| 166 | sols_used = 0; | 201 | sols_used = 0; |
| 167 | shortest_sol = MAXLEN_COORDSOL + 1; | 202 | shortest_sol = MAXLEN_COORDSOL + 1; |
| 168 | c = transform(cube, t); | ||
| 169 | t = coord->axistrans[axis]; | 203 | t = coord->axistrans[axis]; |
| 204 | c = transform(cube, t); | ||
| 170 | 205 | ||
| 171 | arg = (dfsarg_solve_coord_t) { | 206 | arg = (dfsarg_solve_coord_t) { |
| 172 | .cube = c, | 207 | .cube = c, |
diff --git a/src/solvers/coord/coord_types_macros.h b/src/solvers/coord/types_macros.h index 594f594..594f594 100644 --- a/src/solvers/coord/coord_types_macros.h +++ b/src/solvers/coord/types_macros.h | |||
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 44f6a89..182beee 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -145,8 +145,7 @@ solve_h48_appendallsym(dfsarg_solve_h48_t *arg) | |||
| 145 | goto solve_h48_appendallsym_error; | 145 | goto solve_h48_appendallsym_error; |
| 146 | 146 | ||
| 147 | (*arg->nsols)++; | 147 | (*arg->nsols)++; |
| 148 | *arg->shortest_sol = | 148 | *arg->shortest_sol = MIN(*arg->shortest_sol, n); |
| 149 | MIN(*arg->shortest_sol, arg->nmoves + arg->npremoves); | ||
| 150 | ret++; | 149 | ret++; |
| 151 | } | 150 | } |
| 152 | 151 | ||
| @@ -291,7 +290,7 @@ solve_h48_dfs(dfsarg_solve_h48_t *arg) | |||
| 291 | if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { | 290 | if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { |
| 292 | arg->nmoves++; | 291 | arg->nmoves++; |
| 293 | for (m = 0; m < 18; m++) { | 292 | for (m = 0; m < 18; m++) { |
| 294 | if (!(mm_normal & (1 << m))) | 293 | if (!(mm_normal & (UINT32_C(1) << (uint32_t)m))) |
| 295 | continue; | 294 | continue; |
| 296 | arg->moves[arg->nmoves-1] = m; | 295 | arg->moves[arg->nmoves-1] = m; |
| 297 | arg->cube = move(backup_cube, m); | 296 | arg->cube = move(backup_cube, m); |
| @@ -308,7 +307,7 @@ solve_h48_dfs(dfsarg_solve_h48_t *arg) | |||
| 308 | } else { | 307 | } else { |
| 309 | arg->npremoves++; | 308 | arg->npremoves++; |
| 310 | for (m = 0; m < 18; m++) { | 309 | for (m = 0; m < 18; m++) { |
| 311 | if(!(mm_inverse & (1 << m))) | 310 | if(!(mm_inverse & (UINT32_C(1) << (uint32_t)m))) |
| 312 | continue; | 311 | continue; |
| 313 | arg->premoves[arg->npremoves-1] = m; | 312 | arg->premoves[arg->npremoves-1] = m; |
| 314 | arg->inverse = move(backup_inverse, m); | 313 | arg->inverse = move(backup_inverse, m); |
