diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-18 08:48:13 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-18 08:48:13 +0200 |
| commit | 8b94d135429a9f3253cc7f25a1453b412065c4a0 (patch) | |
| tree | 4a31d6def5421e95fb98505a2bc2653c18fca330 /src/solvers/h48/solve.h | |
| parent | 30b43f08955158d4f2066f4b50fe8d1241b3177b (diff) | |
| download | nissy-core-8b94d135429a9f3253cc7f25a1453b412065c4a0.tar.gz nissy-core-8b94d135429a9f3253cc7f25a1453b412065c4a0.zip | |
Refactor solver dispatch and checkdata
Diffstat (limited to 'src/solvers/h48/solve.h')
| -rw-r--r-- | src/solvers/h48/solve.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index f2967ed..2818c09 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -50,6 +50,10 @@ typedef struct { | |||
| 50 | int8_t *shortest_sol; | 50 | int8_t *shortest_sol; |
| 51 | } dfsarg_solve_h48_maketasks_t; | 51 | } dfsarg_solve_h48_maketasks_t; |
| 52 | 52 | ||
| 53 | STATIC long long solve_h48_dispatch(oriented_cube_t, const char *, unsigned, | ||
| 54 | unsigned, unsigned, unsigned, unsigned, unsigned, unsigned long long n, | ||
| 55 | const unsigned char [n], unsigned m, char [m], | ||
| 56 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); | ||
| 53 | STATIC_INLINE bool solve_h48_stop(dfsarg_solve_h48_t [static 1]); | 57 | STATIC_INLINE bool solve_h48_stop(dfsarg_solve_h48_t [static 1]); |
| 54 | STATIC int64_t solve_h48_maketasks( | 58 | STATIC int64_t solve_h48_maketasks( |
| 55 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], | 59 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], |
| @@ -61,6 +65,36 @@ STATIC int64_t solve_h48(oriented_cube_t, uint8_t, uint8_t, uint8_t, uint8_t, | |||
| 61 | uint8_t, uint64_t, const unsigned char *, size_t n, char [n], | 65 | uint8_t, uint64_t, const unsigned char *, size_t n, char [n], |
| 62 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); | 66 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); |
| 63 | 67 | ||
| 68 | STATIC long long solve_h48_dispatch( | ||
| 69 | oriented_cube_t oc, | ||
| 70 | const char *solver, | ||
| 71 | unsigned nissflag, | ||
| 72 | unsigned minmoves, | ||
| 73 | unsigned maxmoves, | ||
| 74 | unsigned maxsols, | ||
| 75 | unsigned optimal, | ||
| 76 | unsigned threads, | ||
| 77 | unsigned long long data_size, | ||
| 78 | const unsigned char data[data_size], | ||
| 79 | unsigned sols_size, | ||
| 80 | char sols[sols_size], | ||
| 81 | long long stats[static NISSY_SIZE_SOLVE_STATS], | ||
| 82 | int (*poll_status)(void *), | ||
| 83 | void *poll_status_data | ||
| 84 | ) | ||
| 85 | { | ||
| 86 | uint8_t h, k; | ||
| 87 | long long err; | ||
| 88 | |||
| 89 | err = parse_h48_hk(solver, &h, &k); | ||
| 90 | if (err != NISSY_OK) | ||
| 91 | return err; | ||
| 92 | |||
| 93 | return solve_h48(oc, minmoves, maxmoves, maxsols, optimal, threads, | ||
| 94 | data_size, data, sols_size, sols, stats, | ||
| 95 | poll_status, poll_status_data); | ||
| 96 | } | ||
| 97 | |||
| 64 | STATIC_INLINE bool | 98 | STATIC_INLINE bool |
| 65 | solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) | 99 | solve_h48_stop(dfsarg_solve_h48_t arg[static 1]) |
| 66 | { | 100 | { |
