aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/solve.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/solvers/h48/solve.h')
-rw-r--r--src/solvers/h48/solve.h42
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); 29STATIC uint32_t allowednextmove_h48(uint8_t *, uint8_t, uint32_t);
30 30
31_static void solve_h48_appendsolution(dfsarg_solveh48_t *); 31STATIC void solve_h48_appendsolution(dfsarg_solveh48_t *);
32_static_inline bool solve_h48_stop(dfsarg_solveh48_t *); 32STATIC_INLINE bool solve_h48_stop(dfsarg_solveh48_t *);
33_static int64_t solve_h48_dfs(dfsarg_solveh48_t *); 33STATIC 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 *); 34STATIC 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 *); 36STATIC int64_t solve_h48stats_dfs(dfsarg_solveh48stats_t *);
37_static int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]); 37STATIC int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]);
38 38
39_static uint32_t 39STATIC uint32_t
40allowednextmove_h48(uint8_t *moves, uint8_t n, uint32_t h48branch) 40allowednextmove_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 67STATIC void
68solve_h48_appendsolution(dfsarg_solveh48_t *arg) 68solve_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 92STATIC_INLINE bool
93solve_h48_stop(dfsarg_solveh48_t *arg) 93solve_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 123STATIC int64_t
124solve_h48_dfs(dfsarg_solveh48_t *arg) 124solve_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 174STATIC int64_t
175solve_h48( 175solve_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.
219The solutions array is filled with the length of the solutions. The 219The solutions array is filled with the length of the solutions. The
220solution array is therefore not a printable string. 220solution array is therefore not a printable string.
221*/ 221*/
222_static int64_t 222STATIC int64_t
223solve_h48stats_dfs(dfsarg_solveh48stats_t *arg) 223solve_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 271STATIC int64_t
272solve_h48stats( 272solve_h48stats(
273 cube_t cube, 273 cube_t cube,
274 int8_t maxmoves, 274 int8_t maxmoves,

Generated with cgit - Back to sebastiano.tronto.net