diff options
Diffstat (limited to 'src/solvers/h48/solve.h')
| -rw-r--r-- | src/solvers/h48/solve.h | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 4fd0aea..ebc5208 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -64,27 +64,27 @@ typedef struct { | |||
| 64 | STATIC long long solve_h48_dispatch(oriented_cube_t, const char *, unsigned, | 64 | STATIC long long solve_h48_dispatch(oriented_cube_t, const char *, unsigned, |
| 65 | unsigned, unsigned, unsigned, unsigned, unsigned, unsigned long long, | 65 | unsigned, unsigned, unsigned, unsigned, unsigned, unsigned long long, |
| 66 | const unsigned char *, unsigned, char *, | 66 | const unsigned char *, unsigned, char *, |
| 67 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); | 67 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); |
| 68 | STATIC_INLINE void h48_prune_pipeline(dfsarg_solve_h48_t [static 1], | 68 | STATIC_INLINE void h48_prune_pipeline(dfsarg_solve_h48_t [NON_NULL], |
| 69 | h48_prune_t [static NMOVES], uint8_t, bool); | 69 | h48_prune_t [SIZE(NMOVES)], uint8_t, bool); |
| 70 | STATIC_INLINE uint8_t h48_prune_lookup( | 70 | STATIC_INLINE uint8_t h48_prune_lookup( |
| 71 | uint64_t, cube_t, dfsarg_solve_h48_t [static 1]); | 71 | uint64_t, cube_t, dfsarg_solve_h48_t [NON_NULL]); |
| 72 | STATIC_INLINE uint8_t h48_prune_lookup_nocoord( | 72 | STATIC_INLINE uint8_t h48_prune_lookup_nocoord( |
| 73 | cube_t, dfsarg_solve_h48_t [static 1]); | 73 | cube_t, dfsarg_solve_h48_t [NON_NULL]); |
| 74 | STATIC_INLINE void h48_prune_restore_normal(const h48_prune_t [static 1], | 74 | STATIC_INLINE void h48_prune_restore_normal(const h48_prune_t [NON_NULL], |
| 75 | dfsarg_solve_h48_t [static 1], uint8_t); | 75 | dfsarg_solve_h48_t [NON_NULL], uint8_t); |
| 76 | STATIC_INLINE void h48_prune_restore_inverse(const h48_prune_t [static 1], | 76 | STATIC_INLINE void h48_prune_restore_inverse(const h48_prune_t [NON_NULL], |
| 77 | dfsarg_solve_h48_t [static 1], uint8_t); | 77 | dfsarg_solve_h48_t [NON_NULL], uint8_t); |
| 78 | STATIC int64_t solve_h48_maketasks( | 78 | STATIC int64_t solve_h48_maketasks( |
| 79 | dfsarg_solve_h48_t [static 1], dfsarg_solve_h48_maketasks_t [static 1], | 79 | dfsarg_solve_h48_t [NON_NULL], dfsarg_solve_h48_maketasks_t [NON_NULL], |
| 80 | solve_h48_task_t [static H48_STARTING_CUBES], int [static 1]); | 80 | solve_h48_task_t [SIZE(H48_STARTING_CUBES)], int [NON_NULL]); |
| 81 | STATIC wrapthread_return_t solve_h48_runthread(void *); | 81 | STATIC wrapthread_return_t solve_h48_runthread(void *); |
| 82 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [static 1]); | 82 | STATIC int64_t solve_h48_dfs(dfsarg_solve_h48_t [NON_NULL]); |
| 83 | STATIC void solve_h48_log_solutions(solution_list_t [static 1], size_t); | 83 | STATIC void solve_h48_log_solutions(solution_list_t [NON_NULL], size_t); |
| 84 | STATIC int solve_h48_compare_tasks(const void *, const void *); | 84 | STATIC int solve_h48_compare_tasks(const void *, const void *); |
| 85 | STATIC int64_t solve_h48(oriented_cube_t, uint8_t, uint8_t, uint64_t, uint8_t, | 85 | STATIC int64_t solve_h48(oriented_cube_t, uint8_t, uint8_t, uint64_t, uint8_t, |
| 86 | uint8_t, uint64_t, const unsigned char *, size_t, char *, | 86 | uint8_t, uint64_t, const unsigned char *, size_t, char *, |
| 87 | long long [static NISSY_SIZE_SOLVE_STATS], int (*)(void *), void *); | 87 | long long [SIZE(NISSY_SIZE_SOLVE_STATS)], int (*)(void *), void *); |
| 88 | 88 | ||
| 89 | STATIC long long solve_h48_dispatch( | 89 | STATIC long long solve_h48_dispatch( |
| 90 | oriented_cube_t oc, | 90 | oriented_cube_t oc, |
| @@ -99,7 +99,7 @@ STATIC long long solve_h48_dispatch( | |||
| 99 | const unsigned char *data, | 99 | const unsigned char *data, |
| 100 | unsigned sols_size, | 100 | unsigned sols_size, |
| 101 | char *sols, | 101 | char *sols, |
| 102 | long long stats[static NISSY_SIZE_SOLVE_STATS], | 102 | long long stats[SIZE(NISSY_SIZE_SOLVE_STATS)], |
| 103 | int (*poll_status)(void *), | 103 | int (*poll_status)(void *), |
| 104 | void *poll_status_data | 104 | void *poll_status_data |
| 105 | ) | 105 | ) |
| @@ -111,7 +111,8 @@ STATIC long long solve_h48_dispatch( | |||
| 111 | if (err != NISSY_OK) | 111 | if (err != NISSY_OK) |
| 112 | return err; | 112 | return err; |
| 113 | 113 | ||
| 114 | return solve_h48(oc, minmoves, maxmoves, maxsols, optimal, threads, | 114 | return solve_h48(oc, (uint8_t)minmoves, (uint8_t)maxmoves, |
| 115 | (uint8_t)maxsols, (uint8_t)optimal, (uint8_t)threads, | ||
| 115 | data_size, data, sols_size, sols, stats, | 116 | data_size, data, sols_size, sols, stats, |
| 116 | poll_status, poll_status_data); | 117 | poll_status, poll_status_data); |
| 117 | } | 118 | } |
| @@ -120,7 +121,7 @@ STATIC_INLINE uint8_t | |||
| 120 | h48_prune_lookup( | 121 | h48_prune_lookup( |
| 121 | uint64_t coord, | 122 | uint64_t coord, |
| 122 | cube_t cube, | 123 | cube_t cube, |
| 123 | dfsarg_solve_h48_t arg[static 1] | 124 | dfsarg_solve_h48_t arg[NON_NULL] |
| 124 | ) | 125 | ) |
| 125 | { | 126 | { |
| 126 | uint8_t p, pmin, pe; | 127 | uint8_t p, pmin, pe; |
| @@ -139,7 +140,7 @@ h48_prune_lookup( | |||
| 139 | STATIC_INLINE uint8_t | 140 | STATIC_INLINE uint8_t |
| 140 | h48_prune_lookup_nocoord( | 141 | h48_prune_lookup_nocoord( |
| 141 | cube_t cube, | 142 | cube_t cube, |
| 142 | dfsarg_solve_h48_t arg[static 1] | 143 | dfsarg_solve_h48_t arg[NON_NULL] |
| 143 | ) | 144 | ) |
| 144 | { | 145 | { |
| 145 | uint32_t cdata; | 146 | uint32_t cdata; |
| @@ -152,8 +153,8 @@ h48_prune_lookup_nocoord( | |||
| 152 | 153 | ||
| 153 | STATIC_INLINE void | 154 | STATIC_INLINE void |
| 154 | h48_prune_pipeline( | 155 | h48_prune_pipeline( |
| 155 | dfsarg_solve_h48_t arg[static 1], | 156 | dfsarg_solve_h48_t arg[NON_NULL], |
| 156 | h48_prune_t prune[static NMOVES], | 157 | h48_prune_t prune[SIZE(NMOVES)], |
| 157 | uint8_t target, | 158 | uint8_t target, |
| 158 | bool normal | 159 | bool normal |
| 159 | ) | 160 | ) |
| @@ -252,8 +253,8 @@ h48_prune_pipeline( | |||
| 252 | 253 | ||
| 253 | STATIC_INLINE void | 254 | STATIC_INLINE void |
| 254 | h48_prune_restore_normal( | 255 | h48_prune_restore_normal( |
| 255 | const h48_prune_t prune[static 1], | 256 | const h48_prune_t prune[NON_NULL], |
| 256 | dfsarg_solve_h48_t arg[static 1], | 257 | dfsarg_solve_h48_t arg[NON_NULL], |
| 257 | uint8_t target | 258 | uint8_t target |
| 258 | ) | 259 | ) |
| 259 | { | 260 | { |
| @@ -276,8 +277,8 @@ h48_prune_restore_normal( | |||
| 276 | 277 | ||
| 277 | STATIC_INLINE void | 278 | STATIC_INLINE void |
| 278 | h48_prune_restore_inverse( | 279 | h48_prune_restore_inverse( |
| 279 | const h48_prune_t prune[static 1], | 280 | const h48_prune_t prune[NON_NULL], |
| 280 | dfsarg_solve_h48_t arg[static 1], | 281 | dfsarg_solve_h48_t arg[NON_NULL], |
| 281 | uint8_t target | 282 | uint8_t target |
| 282 | ) | 283 | ) |
| 283 | { | 284 | { |
| @@ -299,7 +300,7 @@ h48_prune_restore_inverse( | |||
| 299 | } | 300 | } |
| 300 | 301 | ||
| 301 | STATIC int64_t | 302 | STATIC int64_t |
| 302 | solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | 303 | solve_h48_dfs(dfsarg_solve_h48_t arg[NON_NULL]) |
| 303 | { | 304 | { |
| 304 | int64_t ret, n; | 305 | int64_t ret, n; |
| 305 | uint8_t m, nm, nn, ni, target; | 306 | uint8_t m, nm, nn, ni, target; |
| @@ -343,7 +344,7 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | |||
| 343 | backup_inverse = arg->inverse; | 344 | backup_inverse = arg->inverse; |
| 344 | 345 | ||
| 345 | ret = 0; | 346 | ret = 0; |
| 346 | if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { | 347 | if (popcount_u64(mm_normal) <= popcount_u64(mm_inverse)) { |
| 347 | h48_prune_pipeline(arg, prune, target, true); | 348 | h48_prune_pipeline(arg, prune, target, true); |
| 348 | arg->solution_moves->nmoves++; | 349 | arg->solution_moves->nmoves++; |
| 349 | for (m = 0; m < NMOVES; m++) { | 350 | for (m = 0; m < NMOVES; m++) { |
| @@ -450,14 +451,13 @@ solve_h48_runthread_end: | |||
| 450 | 451 | ||
| 451 | STATIC int64_t | 452 | STATIC int64_t |
| 452 | solve_h48_maketasks( | 453 | solve_h48_maketasks( |
| 453 | dfsarg_solve_h48_t solve_arg[static 1], | 454 | dfsarg_solve_h48_t solve_arg[NON_NULL], |
| 454 | dfsarg_solve_h48_maketasks_t mtarg[static 1], | 455 | dfsarg_solve_h48_maketasks_t mtarg[NON_NULL], |
| 455 | solve_h48_task_t tasks[static H48_STARTING_CUBES], | 456 | solve_h48_task_t tasks[SIZE(H48_STARTING_CUBES)], |
| 456 | int ntasks[static 1] | 457 | int ntasks[NON_NULL] |
| 457 | ) | 458 | ) |
| 458 | { | 459 | { |
| 459 | int r; | 460 | int64_t r, appret; |
| 460 | int64_t appret; | ||
| 461 | uint8_t m, t; | 461 | uint8_t m, t; |
| 462 | uint64_t mm; | 462 | uint64_t mm; |
| 463 | cube_t backup_cube; | 463 | cube_t backup_cube; |
| @@ -524,7 +524,7 @@ solve_h48_maketasks( | |||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | STATIC void | 526 | STATIC void |
| 527 | solve_h48_log_solutions(solution_list_t s[static 1], size_t e) | 527 | solve_h48_log_solutions(solution_list_t s[NON_NULL], size_t e) |
| 528 | { | 528 | { |
| 529 | size_t i; | 529 | size_t i; |
| 530 | char b; | 530 | char b; |
| @@ -561,7 +561,7 @@ solve_h48( | |||
| 561 | const unsigned char *data, | 561 | const unsigned char *data, |
| 562 | size_t solutions_size, | 562 | size_t solutions_size, |
| 563 | char *solutions, | 563 | char *solutions, |
| 564 | long long stats[static NISSY_SIZE_SOLVE_STATS], | 564 | long long stats[SIZE(NISSY_SIZE_SOLVE_STATS)], |
| 565 | int (*poll_status)(void *), | 565 | int (*poll_status)(void *), |
| 566 | void *poll_status_data | 566 | void *poll_status_data |
| 567 | ) | 567 | ) |
