aboutsummaryrefslogtreecommitdiff
path: root/src/solvers
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2024-09-05 08:53:38 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2024-09-05 08:55:25 +0200
commitfd5ddb3db9f50411ca579d84f225f265ca35b56a (patch)
treeb659112cc0e2abd6c7edb08b0938c0d2de4ca066 /src/solvers
parentc9e2d6466e42d6b779ac9ffa7c5ee9a9c7558df8 (diff)
downloadnissy-core-fd5ddb3db9f50411ca579d84f225f265ca35b56a.tar.gz
nissy-core-fd5ddb3db9f50411ca579d84f225f265ca35b56a.zip
Rename constants from _underscore to CAPS
Diffstat (limited to 'src/solvers')
-rw-r--r--src/solvers/generic/generic.h20
-rw-r--r--src/solvers/h48/coordinate.h14
-rw-r--r--src/solvers/h48/gendata_cocsep.h22
-rw-r--r--src/solvers/h48/gendata_h48.h48
-rw-r--r--src/solvers/h48/map.h28
-rw-r--r--src/solvers/h48/solve.h42
6 files changed, 87 insertions, 87 deletions
diff --git a/src/solvers/generic/generic.h b/src/solvers/generic/generic.h
index 41d995a..1e0299b 100644
--- a/src/solvers/generic/generic.h
+++ b/src/solvers/generic/generic.h
@@ -9,14 +9,14 @@ typedef struct {
9 uint8_t (*estimate)(cube_t); 9 uint8_t (*estimate)(cube_t);
10} dfsarg_generic_t; 10} dfsarg_generic_t;
11 11
12_static void solve_generic_appendsolution(dfsarg_generic_t *); 12STATIC void solve_generic_appendsolution(dfsarg_generic_t *);
13_static int solve_generic_dfs(dfsarg_generic_t *); 13STATIC int solve_generic_dfs(dfsarg_generic_t *);
14_static int64_t solve_generic(cube_t, const char *, int8_t, int8_t, int64_t, 14STATIC int64_t solve_generic(cube_t, const char *, int8_t, int8_t, int64_t,
15 int8_t, char *, uint8_t (*)(cube_t)); 15 int8_t, char *, uint8_t (*)(cube_t));
16_static uint8_t estimate_simple(cube_t); 16STATIC uint8_t estimate_simple(cube_t);
17_static int64_t solve_simple(cube_t, int8_t, int8_t, int64_t, int8_t, char *); 17STATIC int64_t solve_simple(cube_t, int8_t, int8_t, int64_t, int8_t, char *);
18 18
19_static void 19STATIC void
20solve_generic_appendsolution(dfsarg_generic_t *arg) 20solve_generic_appendsolution(dfsarg_generic_t *arg)
21{ 21{
22 int strl; 22 int strl;
@@ -29,7 +29,7 @@ solve_generic_appendsolution(dfsarg_generic_t *arg)
29 (*arg->nsols)++; 29 (*arg->nsols)++;
30} 30}
31 31
32_static int 32STATIC int
33solve_generic_dfs(dfsarg_generic_t *arg) 33solve_generic_dfs(dfsarg_generic_t *arg)
34{ 34{
35 dfsarg_generic_t nextarg; 35 dfsarg_generic_t nextarg;
@@ -64,7 +64,7 @@ solve_generic_dfs(dfsarg_generic_t *arg)
64 return ret; 64 return ret;
65} 65}
66 66
67_static int64_t 67STATIC int64_t
68solve_generic( 68solve_generic(
69 cube_t cube, 69 cube_t cube,
70 const char *nisstype, 70 const char *nisstype,
@@ -128,13 +128,13 @@ solve_generic(
128 return ret; 128 return ret;
129} 129}
130 130
131_static uint8_t 131STATIC uint8_t
132estimate_simple(cube_t cube) 132estimate_simple(cube_t cube)
133{ 133{
134 return issolved(cube) ? 0 : 1; 134 return issolved(cube) ? 0 : 1;
135} 135}
136 136
137_static int64_t 137STATIC int64_t
138solve_simple( 138solve_simple(
139 cube_t cube, 139 cube_t cube,
140 int8_t minmoves, 140 int8_t minmoves,
diff --git a/src/solvers/h48/coordinate.h b/src/solvers/h48/coordinate.h
index 47b805d..4da5575 100644
--- a/src/solvers/h48/coordinate.h
+++ b/src/solvers/h48/coordinate.h
@@ -1,15 +1,15 @@
1#define H48_ESIZE(h) ((_12c4 * _8c4) << (int64_t)(h)) 1#define H48_ESIZE(h) ((COMB_12_4 * COMB_8_4) << (int64_t)(h))
2 2
3#define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16)) 3#define COCLASS_MASK (UINT32_C(0xFFFF) << UINT32_C(16))
4#define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16)) 4#define COCLASS(x) (((x) & COCLASS_MASK) >> UINT32_C(16))
5#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8)) 5#define TTREP_MASK (UINT32_C(0xFF) << UINT32_C(8))
6#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8)) 6#define TTREP(x) (((x) & TTREP_MASK) >> UINT32_C(8))
7 7
8_static_inline int64_t coord_h48(cube_t, const uint32_t *, uint8_t); 8STATIC_INLINE int64_t coord_h48(cube_t, const uint32_t *, uint8_t);
9_static_inline int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t); 9STATIC_INLINE int64_t coord_h48_edges(cube_t, int64_t, uint8_t, uint8_t);
10_static_inline cube_t invcoord_h48(int64_t, const cube_t *, uint8_t); 10STATIC_INLINE cube_t invcoord_h48(int64_t, const cube_t *, uint8_t);
11 11
12_static_inline int64_t 12STATIC_INLINE int64_t
13coord_h48(cube_t c, const uint32_t *cocsepdata, uint8_t h) 13coord_h48(cube_t c, const uint32_t *cocsepdata, uint8_t h)
14{ 14{
15 int64_t cocsep, coclass; 15 int64_t cocsep, coclass;
@@ -26,7 +26,7 @@ coord_h48(cube_t c, const uint32_t *cocsepdata, uint8_t h)
26 return coord_h48_edges(c, coclass, ttrep, h); 26 return coord_h48_edges(c, coclass, ttrep, h);
27} 27}
28 28
29_static_inline int64_t 29STATIC_INLINE int64_t
30coord_h48_edges(cube_t c, int64_t coclass, uint8_t ttrep, uint8_t h) 30coord_h48_edges(cube_t c, int64_t coclass, uint8_t ttrep, uint8_t h)
31{ 31{
32 cube_t d; 32 cube_t d;
@@ -45,7 +45,7 @@ This function does not necessarily return a cube whose coordinate is
45the given value, because it works up to symmetry. This means that the 45the given value, because it works up to symmetry. This means that the
46returned cube is a transformed cube of one that gives the correct value. 46returned cube is a transformed cube of one that gives the correct value.
47*/ 47*/
48_static_inline cube_t 48STATIC_INLINE cube_t
49invcoord_h48(int64_t i, const cube_t *crep, uint8_t h) 49invcoord_h48(int64_t i, const cube_t *crep, uint8_t h)
50{ 50{
51 cube_t ret; 51 cube_t ret;
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h
index b7d28e1..54e092e 100644
--- a/src/solvers/h48/gendata_cocsep.h
+++ b/src/solvers/h48/gendata_cocsep.h
@@ -1,5 +1,5 @@
1#define COCSEP_CLASSES ((size_t)3393) 1#define COCSEP_CLASSES ((size_t)3393)
2#define COCSEP_TABLESIZE ((size_t)_3p7 << (size_t)7) 2#define COCSEP_TABLESIZE ((size_t)POW_3_7 << (size_t)7)
3#define COCSEP_VISITEDSIZE ((COCSEP_TABLESIZE + (size_t)7) / (size_t)8) 3#define COCSEP_VISITEDSIZE ((COCSEP_TABLESIZE + (size_t)7) / (size_t)8)
4#define COCSEP_FULLSIZE ((size_t)4 * (COCSEP_TABLESIZE + (size_t)12)) 4#define COCSEP_FULLSIZE ((size_t)4 * (COCSEP_TABLESIZE + (size_t)12))
5 5
@@ -20,13 +20,13 @@ typedef struct {
20 cube_t *rep; 20 cube_t *rep;
21} cocsep_dfs_arg_t; 21} cocsep_dfs_arg_t;
22 22
23_static_inline bool get_visited(const uint8_t *, int64_t); 23STATIC_INLINE bool get_visited(const uint8_t *, int64_t);
24_static_inline void set_visited(uint8_t *, int64_t); 24STATIC_INLINE void set_visited(uint8_t *, int64_t);
25 25
26_static size_t gendata_cocsep(void *, uint64_t *, cube_t *); 26STATIC size_t gendata_cocsep(void *, uint64_t *, cube_t *);
27_static uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *); 27STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t *);
28 28
29_static_inline int8_t get_h48_cdata(cube_t, uint32_t *, uint32_t *); 29STATIC_INLINE int8_t get_h48_cdata(cube_t, uint32_t *, uint32_t *);
30 30
31/* 31/*
32Each element of the cocsep table is a uint32_t used as follows: 32Each element of the cocsep table is a uint32_t used as follows:
@@ -39,7 +39,7 @@ After the data as described above, more auxiliary information is appended:
39 - One uint32_t for each "line" of the pruning table, representing the number 39 - One uint32_t for each "line" of the pruning table, representing the number
40 of positions having that pruning value. 40 of positions having that pruning value.
41*/ 41*/
42_static size_t 42STATIC size_t
43gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep) 43gendata_cocsep(void *buf, uint64_t *selfsim, cube_t *rep)
44{ 44{
45 uint32_t *buf32, *info, cc; 45 uint32_t *buf32, *info, cc;
@@ -91,7 +91,7 @@ gendata_cocsep_return_size:
91 return COCSEP_FULLSIZE; 91 return COCSEP_FULLSIZE;
92} 92}
93 93
94_static uint32_t 94STATIC uint32_t
95gendata_cocsep_dfs(cocsep_dfs_arg_t *arg) 95gendata_cocsep_dfs(cocsep_dfs_arg_t *arg)
96{ 96{
97 uint8_t m; 97 uint8_t m;
@@ -145,19 +145,19 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t *arg)
145 return cc; 145 return cc;
146} 146}
147 147
148_static_inline bool 148STATIC_INLINE bool
149get_visited(const uint8_t *a, int64_t i) 149get_visited(const uint8_t *a, int64_t i)
150{ 150{
151 return a[VISITED_IND(i)] & VISITED_MASK(i); 151 return a[VISITED_IND(i)] & VISITED_MASK(i);
152} 152}
153 153
154_static_inline void 154STATIC_INLINE void
155set_visited(uint8_t *a, int64_t i) 155set_visited(uint8_t *a, int64_t i)
156{ 156{
157 a[VISITED_IND(i)] |= VISITED_MASK(i); 157 a[VISITED_IND(i)] |= VISITED_MASK(i);
158} 158}
159 159
160_static_inline int8_t 160STATIC_INLINE int8_t
161get_h48_cdata(cube_t cube, uint32_t *cocsepdata, uint32_t *cdata) 161get_h48_cdata(cube_t cube, uint32_t *cocsepdata, uint32_t *cdata)
162{ 162{
163 int64_t coord; 163 int64_t coord;
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h
index 6486834..0778b3c 100644
--- a/src/solvers/h48/gendata_h48.h
+++ b/src/solvers/h48/gendata_h48.h
@@ -1,4 +1,4 @@
1#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * _12c4 * _8c4)) 1#define H48_COORDMAX_NOEO ((int64_t)(COCSEP_CLASSES * COMB_12_4 * COMB_8_4))
2#define H48_COORDMAX(h) ((int64_t)(H48_COORDMAX_NOEO << (int64_t)(h))) 2#define H48_COORDMAX(h) ((int64_t)(H48_COORDMAX_NOEO << (int64_t)(h)))
3#define H48_DIV(k) ((size_t)8 / (size_t)(k)) 3#define H48_DIV(k) ((size_t)8 / (size_t)(k))
4#define H48_TABLESIZE(h, k) _div_round_up((size_t)H48_COORDMAX((h)), H48_DIV(k)) 4#define H48_TABLESIZE(h, k) _div_round_up((size_t)H48_COORDMAX((h)), H48_DIV(k))
@@ -6,7 +6,7 @@
6#define H48_COEFF(k) (UINT32_C(32) / (uint32_t)(k)) 6#define H48_COEFF(k) (UINT32_C(32) / (uint32_t)(k))
7#define H48_INDEX(i, k) ((uint32_t)(i) / H48_COEFF(k)) 7#define H48_INDEX(i, k) ((uint32_t)(i) / H48_COEFF(k))
8#define H48_SHIFT(i, k) ((uint32_t)(k) * ((uint32_t)(i) % H48_COEFF(k))) 8#define H48_SHIFT(i, k) ((uint32_t)(k) * ((uint32_t)(i) % H48_COEFF(k)))
9#define H48_MASK(i, k) ((_bit_u32(k) - (uint32_t)(1)) << H48_SHIFT(i, k)) 9#define H48_MASK(i, k) ((UINT32_BIT(k) - (uint32_t)(1)) << H48_SHIFT(i, k))
10 10
11#define MAXLEN 20 11#define MAXLEN 20
12 12
@@ -74,21 +74,21 @@ typedef struct {
74 h48map_t *shortcubes; 74 h48map_t *shortcubes;
75} h48k2_dfs_arg_t; 75} h48k2_dfs_arg_t;
76 76
77_static_inline uint8_t get_esep_pval(const uint32_t *, int64_t, uint8_t); 77STATIC_INLINE uint8_t get_esep_pval(const uint32_t *, int64_t, uint8_t);
78_static_inline void set_esep_pval(uint32_t *, int64_t, uint8_t, uint8_t); 78STATIC_INLINE void set_esep_pval(uint32_t *, int64_t, uint8_t, uint8_t);
79 79
80_static uint64_t gen_h48short(gendata_h48short_arg_t *); 80STATIC uint64_t gen_h48short(gendata_h48short_arg_t *);
81_static size_t gendata_h48(gendata_h48_arg_t *); 81STATIC size_t gendata_h48(gendata_h48_arg_t *);
82_static size_t gendata_h48h0k4(gendata_h48_arg_t *); 82STATIC size_t gendata_h48h0k4(gendata_h48_arg_t *);
83_static int64_t gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *); 83STATIC int64_t gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *);
84_static int64_t gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *); 84STATIC int64_t gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *);
85_static int64_t gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *); 85STATIC int64_t gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *);
86_static size_t gendata_h48k2(gendata_h48_arg_t *); 86STATIC size_t gendata_h48k2(gendata_h48_arg_t *);
87_static void gendata_h48k2_dfs(h48k2_dfs_arg_t *arg); 87STATIC void gendata_h48k2_dfs(h48k2_dfs_arg_t *arg);
88 88
89_static_inline int8_t get_h48_bound(cube_t, uint32_t, uint8_t, uint8_t, uint32_t *); 89STATIC_INLINE int8_t get_h48_bound(cube_t, uint32_t, uint8_t, uint8_t, uint32_t *);
90 90
91_static uint64_t 91STATIC uint64_t
92gen_h48short(gendata_h48short_arg_t *arg) 92gen_h48short(gendata_h48short_arg_t *arg)
93{ 93{
94 uint8_t i, m; 94 uint8_t i, m;
@@ -129,7 +129,7 @@ gen_h48short(gendata_h48short_arg_t *arg)
129} 129}
130 130
131/* Generic function that dispatches to the data generators */ 131/* Generic function that dispatches to the data generators */
132_static size_t 132STATIC size_t
133gendata_h48(gendata_h48_arg_t *arg) 133gendata_h48(gendata_h48_arg_t *arg)
134{ 134{
135 static const size_t infosize = 88; /* TODO: change to e.g. 1024 */ 135 static const size_t infosize = 88; /* TODO: change to e.g. 1024 */
@@ -164,7 +164,7 @@ gendata_h48(gendata_h48_arg_t *arg)
164TODO description 164TODO description
165generating fixed table with h=0, k=4 165generating fixed table with h=0, k=4
166*/ 166*/
167_static size_t 167STATIC size_t
168gendata_h48h0k4(gendata_h48_arg_t *arg) 168gendata_h48h0k4(gendata_h48_arg_t *arg)
169{ 169{
170 uint32_t j; 170 uint32_t j;
@@ -208,7 +208,7 @@ gendata_h48h0k4_return_size:
208 return H48_TABLESIZE(0, 4); 208 return H48_TABLESIZE(0, 4);
209} 209}
210 210
211_static int64_t 211STATIC int64_t
212gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *arg) 212gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *arg)
213{ 213{
214 const uint8_t breakpoint = 10; /* Hand-picked optimal */ 214 const uint8_t breakpoint = 10; /* Hand-picked optimal */
@@ -219,7 +219,7 @@ gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *arg)
219 return gendata_h48h0k4_bfs_fromnew(arg); 219 return gendata_h48h0k4_bfs_fromnew(arg);
220} 220}
221 221
222_static int64_t 222STATIC int64_t
223gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *arg) 223gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *arg)
224{ 224{
225 uint8_t c, m, x; 225 uint8_t c, m, x;
@@ -249,7 +249,7 @@ gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *arg)
249 return cc; 249 return cc;
250} 250}
251 251
252_static int64_t 252STATIC int64_t
253gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *arg) 253gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *arg)
254{ 254{
255 uint8_t c, m, x; 255 uint8_t c, m, x;
@@ -281,7 +281,7 @@ gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *arg)
281 return cc; 281 return cc;
282} 282}
283 283
284_static size_t 284STATIC size_t
285gendata_h48k2(gendata_h48_arg_t *arg) 285gendata_h48k2(gendata_h48_arg_t *arg)
286{ 286{
287 static const uint8_t shortdepth = 8; 287 static const uint8_t shortdepth = 8;
@@ -363,7 +363,7 @@ gendata_h48k2_return_size:
363 return H48_TABLESIZE(arg->h, 2); 363 return H48_TABLESIZE(arg->h, 2);
364} 364}
365 365
366_static void 366STATIC void
367gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) 367gendata_h48k2_dfs(h48k2_dfs_arg_t *arg)
368{ 368{
369 cube_t ccc; 369 cube_t ccc;
@@ -406,20 +406,20 @@ gendata_h48k2_dfs(h48k2_dfs_arg_t *arg)
406 } 406 }
407} 407}
408 408
409_static_inline uint8_t 409STATIC_INLINE uint8_t
410get_esep_pval(const uint32_t *buf32, int64_t i, uint8_t k) 410get_esep_pval(const uint32_t *buf32, int64_t i, uint8_t k)
411{ 411{
412 return (buf32[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k); 412 return (buf32[H48_INDEX(i, k)] & H48_MASK(i, k)) >> H48_SHIFT(i, k);
413} 413}
414 414
415_static_inline void 415STATIC_INLINE void
416set_esep_pval(uint32_t *buf32, int64_t i, uint8_t k, uint8_t val) 416set_esep_pval(uint32_t *buf32, int64_t i, uint8_t k, uint8_t val)
417{ 417{
418 buf32[H48_INDEX(i, k)] = (buf32[H48_INDEX(i, k)] & (~H48_MASK(i, k))) 418 buf32[H48_INDEX(i, k)] = (buf32[H48_INDEX(i, k)] & (~H48_MASK(i, k)))
419 | (val << H48_SHIFT(i, k)); 419 | (val << H48_SHIFT(i, k));
420} 420}
421 421
422_static_inline int8_t 422STATIC_INLINE int8_t
423get_h48_bound(cube_t cube, uint32_t cdata, uint8_t h, uint8_t k, uint32_t *h48data) 423get_h48_bound(cube_t cube, uint32_t cdata, uint8_t h, uint8_t k, uint32_t *h48data)
424{ 424{
425 int64_t coord; 425 int64_t coord;
diff --git a/src/solvers/h48/map.h b/src/solvers/h48/map.h
index 0e9f926..34416fc 100644
--- a/src/solvers/h48/map.h
+++ b/src/solvers/h48/map.h
@@ -15,15 +15,15 @@ typedef struct {
15 uint64_t val; 15 uint64_t val;
16} kvpair_t; 16} kvpair_t;
17 17
18_static void h48map_create(h48map_t *, uint64_t, uint64_t); 18STATIC void h48map_create(h48map_t *, uint64_t, uint64_t);
19_static void h48map_clear(h48map_t *); 19STATIC void h48map_clear(h48map_t *);
20_static void h48map_destroy(h48map_t *); 20STATIC void h48map_destroy(h48map_t *);
21_static uint64_t h48map_lookup(h48map_t *, uint64_t); 21STATIC uint64_t h48map_lookup(h48map_t *, uint64_t);
22_static void h48map_insertmin(h48map_t *, uint64_t, uint64_t); 22STATIC void h48map_insertmin(h48map_t *, uint64_t, uint64_t);
23_static uint64_t h48map_value(h48map_t *, uint64_t); 23STATIC uint64_t h48map_value(h48map_t *, uint64_t);
24_static kvpair_t h48map_nextkvpair(h48map_t *, uint64_t *); 24STATIC kvpair_t h48map_nextkvpair(h48map_t *, uint64_t *);
25 25
26_static void 26STATIC void
27h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer) 27h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer)
28{ 28{
29 map->capacity = capacity; 29 map->capacity = capacity;
@@ -33,20 +33,20 @@ h48map_create(h48map_t *map, uint64_t capacity, uint64_t randomizer)
33 h48map_clear(map); 33 h48map_clear(map);
34} 34}
35 35
36_static void 36STATIC void
37h48map_clear(h48map_t *map) 37h48map_clear(h48map_t *map)
38{ 38{
39 memset(map->table, 0xFF, map->capacity * sizeof(uint64_t)); 39 memset(map->table, 0xFF, map->capacity * sizeof(uint64_t));
40 map->n = 0; 40 map->n = 0;
41} 41}
42 42
43_static void 43STATIC void
44h48map_destroy(h48map_t *map) 44h48map_destroy(h48map_t *map)
45{ 45{
46 free(map->table); 46 free(map->table);
47} 47}
48 48
49_static_inline uint64_t 49STATIC_INLINE uint64_t
50h48map_lookup(h48map_t *map, uint64_t x) 50h48map_lookup(h48map_t *map, uint64_t x)
51{ 51{
52 uint64_t hash, i; 52 uint64_t hash, i;
@@ -60,7 +60,7 @@ h48map_lookup(h48map_t *map, uint64_t x)
60 return i; 60 return i;
61} 61}
62 62
63_static_inline void 63STATIC_INLINE void
64h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val) 64h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val)
65{ 65{
66 uint64_t i, oldval, min; 66 uint64_t i, oldval, min;
@@ -73,13 +73,13 @@ h48map_insertmin(h48map_t *map, uint64_t key, uint64_t val)
73 map->table[i] = (key & MAP_KEYMASK) | (min << MAP_KEYSHIFT); 73 map->table[i] = (key & MAP_KEYMASK) | (min << MAP_KEYSHIFT);
74} 74}
75 75
76_static_inline uint64_t 76STATIC_INLINE uint64_t
77h48map_value(h48map_t *map, uint64_t key) 77h48map_value(h48map_t *map, uint64_t key)
78{ 78{
79 return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT; 79 return map->table[h48map_lookup(map, key)] >> MAP_KEYSHIFT;
80} 80}
81 81
82_static kvpair_t 82STATIC kvpair_t
83h48map_nextkvpair(h48map_t *map, uint64_t *p) 83h48map_nextkvpair(h48map_t *map, uint64_t *p)
84{ 84{
85 kvpair_t kv; 85 kvpair_t kv;
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