diff options
Diffstat (limited to 'src/solvers/h48/solve.h')
| -rw-r--r-- | src/solvers/h48/solve.h | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index 3878498..88c5a1e 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -26,22 +26,22 @@ typedef struct { | |||
| 26 | char *s; | 26 | char *s; |
| 27 | } dfsarg_solveh48stats_t; | 27 | } dfsarg_solveh48stats_t; |
| 28 | 28 | ||
| 29 | _static uint32_t allowednextmove_h48(uint8_t *, uint8_t, uint32_t); | 29 | STATIC uint32_t allowednextmove_h48(uint8_t *, uint8_t, uint32_t); |
| 30 | 30 | ||
| 31 | _static void solve_h48_appendsolution(dfsarg_solveh48_t *); | 31 | STATIC void solve_h48_appendsolution(dfsarg_solveh48_t *); |
| 32 | _static_inline bool solve_h48_stop(dfsarg_solveh48_t *); | 32 | STATIC_INLINE bool solve_h48_stop(dfsarg_solveh48_t *); |
| 33 | _static int64_t solve_h48_dfs(dfsarg_solveh48_t *); | 33 | STATIC int64_t solve_h48_dfs(dfsarg_solveh48_t *); |
| 34 | _static int64_t solve_h48(cube_t, int8_t, int8_t, int8_t, uint8_t, uint8_t, const void *, char *); | 34 | STATIC int64_t solve_h48(cube_t, int8_t, int8_t, int8_t, uint8_t, uint8_t, const void *, char *); |
| 35 | 35 | ||
| 36 | _static int64_t solve_h48stats_dfs(dfsarg_solveh48stats_t *); | 36 | STATIC int64_t solve_h48stats_dfs(dfsarg_solveh48stats_t *); |
| 37 | _static int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]); | 37 | STATIC int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]); |
| 38 | 38 | ||
| 39 | _static uint32_t | 39 | STATIC uint32_t |
| 40 | allowednextmove_h48(uint8_t *moves, uint8_t n, uint32_t h48branch) | 40 | allowednextmove_h48(uint8_t *moves, uint8_t n, uint32_t h48branch) |
| 41 | { | 41 | { |
| 42 | uint32_t result = _mm_allmoves; | 42 | uint32_t result = MM_ALLMOVES; |
| 43 | if (h48branch & _mm_normalbranch) | 43 | if (h48branch & MM_NORMALBRANCH) |
| 44 | result &= _mm_nohalfturns; | 44 | result &= MM_NOHALFTURNS; |
| 45 | if (n < 1) | 45 | if (n < 1) |
| 46 | return result; | 46 | return result; |
| 47 | 47 | ||
| @@ -64,7 +64,7 @@ allowednextmove_h48(uint8_t *moves, uint8_t n, uint32_t h48branch) | |||
| 64 | return result; | 64 | return result; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | _static void | 67 | STATIC void |
| 68 | solve_h48_appendsolution(dfsarg_solveh48_t *arg) | 68 | solve_h48_appendsolution(dfsarg_solveh48_t *arg) |
| 69 | { | 69 | { |
| 70 | int strl; | 70 | int strl; |
| @@ -89,13 +89,13 @@ solve_h48_appendsolution(dfsarg_solveh48_t *arg) | |||
| 89 | (*arg->nsols)++; | 89 | (*arg->nsols)++; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | _static_inline bool | 92 | STATIC_INLINE bool |
| 93 | solve_h48_stop(dfsarg_solveh48_t *arg) | 93 | solve_h48_stop(dfsarg_solveh48_t *arg) |
| 94 | { | 94 | { |
| 95 | uint32_t data, data_inv; | 95 | uint32_t data, data_inv; |
| 96 | int8_t bound; | 96 | int8_t bound; |
| 97 | 97 | ||
| 98 | arg->nissbranch = _mm_normal; | 98 | arg->nissbranch = MM_NORMAL; |
| 99 | bound = get_h48_cdata(arg->cube, arg->cocsepdata, &data); | 99 | bound = get_h48_cdata(arg->cube, arg->cocsepdata, &data); |
| 100 | if (bound + arg->nmoves + arg->npremoves > arg->depth) | 100 | if (bound + arg->nmoves + arg->npremoves > arg->depth) |
| 101 | return true; | 101 | return true; |
| @@ -109,18 +109,18 @@ solve_h48_stop(dfsarg_solveh48_t *arg) | |||
| 109 | if (bound + arg->nmoves + arg->npremoves > arg->depth) | 109 | if (bound + arg->nmoves + arg->npremoves > arg->depth) |
| 110 | return true; | 110 | return true; |
| 111 | if (bound + arg->nmoves + arg->npremoves == arg->depth) | 111 | if (bound + arg->nmoves + arg->npremoves == arg->depth) |
| 112 | arg->nissbranch = _mm_inversebranch; | 112 | arg->nissbranch = MM_INVERSEBRANCH; |
| 113 | 113 | ||
| 114 | bound = get_h48_bound(arg->inverse, data_inv, arg->h, arg->k, arg->h48data); | 114 | bound = get_h48_bound(arg->inverse, data_inv, arg->h, arg->k, arg->h48data); |
| 115 | if (bound + arg->nmoves + arg->npremoves > arg->depth) | 115 | if (bound + arg->nmoves + arg->npremoves > arg->depth) |
| 116 | return true; | 116 | return true; |
| 117 | if (bound + arg->nmoves + arg->npremoves == arg->depth) | 117 | if (bound + arg->nmoves + arg->npremoves == arg->depth) |
| 118 | arg->nissbranch = _mm_normalbranch; | 118 | arg->nissbranch = MM_NORMALBRANCH; |
| 119 | 119 | ||
| 120 | return false; | 120 | return false; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | _static int64_t | 123 | STATIC int64_t |
| 124 | solve_h48_dfs(dfsarg_solveh48_t *arg) | 124 | solve_h48_dfs(dfsarg_solveh48_t *arg) |
| 125 | { | 125 | { |
| 126 | dfsarg_solveh48_t nextarg; | 126 | dfsarg_solveh48_t nextarg; |
| @@ -144,7 +144,7 @@ solve_h48_dfs(dfsarg_solveh48_t *arg) | |||
| 144 | nextarg = *arg; | 144 | nextarg = *arg; |
| 145 | ret = 0; | 145 | ret = 0; |
| 146 | uint32_t allowed; | 146 | uint32_t allowed; |
| 147 | if(arg->nissbranch & _mm_inverse) { | 147 | if(arg->nissbranch & MM_INVERSE) { |
| 148 | allowed = allowednextmove_h48(arg->premoves, arg->npremoves, arg->nissbranch); | 148 | allowed = allowednextmove_h48(arg->premoves, arg->npremoves, arg->nissbranch); |
| 149 | for (m = 0; m < 18; m++) { | 149 | for (m = 0; m < 18; m++) { |
| 150 | if(allowed & (1 << m)) { | 150 | if(allowed & (1 << m)) { |
| @@ -171,7 +171,7 @@ solve_h48_dfs(dfsarg_solveh48_t *arg) | |||
| 171 | return ret; | 171 | return ret; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | _static int64_t | 174 | STATIC int64_t |
| 175 | solve_h48( | 175 | solve_h48( |
| 176 | cube_t cube, | 176 | cube_t cube, |
| 177 | int8_t minmoves, | 177 | int8_t minmoves, |
| @@ -219,7 +219,7 @@ each of the 12 h48 coordinates, one for each value of h from 0 to 11. | |||
| 219 | The solutions array is filled with the length of the solutions. The | 219 | The solutions array is filled with the length of the solutions. The |
| 220 | solution array is therefore not a printable string. | 220 | solution array is therefore not a printable string. |
| 221 | */ | 221 | */ |
| 222 | _static int64_t | 222 | STATIC int64_t |
| 223 | solve_h48stats_dfs(dfsarg_solveh48stats_t *arg) | 223 | solve_h48stats_dfs(dfsarg_solveh48stats_t *arg) |
| 224 | { | 224 | { |
| 225 | const int64_t limit = 11; | 225 | const int64_t limit = 11; |
| @@ -268,7 +268,7 @@ solve_h48stats_dfs(dfsarg_solveh48stats_t *arg) | |||
| 268 | return 0; | 268 | return 0; |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | _static int64_t | 271 | STATIC int64_t |
| 272 | solve_h48stats( | 272 | solve_h48stats( |
| 273 | cube_t cube, | 273 | cube_t cube, |
| 274 | int8_t maxmoves, | 274 | int8_t maxmoves, |
