aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/solve_h48.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/solve_h48.h b/src/solve_h48.h
index d4a018b..b04ae47 100644
--- a/src/solve_h48.h
+++ b/src/solve_h48.h
@@ -8,13 +8,13 @@
8#define ESEP_VISITEDSIZE ((ESEP_TABLESIZE * 2U + 7U) / 8U) 8#define ESEP_VISITEDSIZE ((ESEP_TABLESIZE * 2U + 7U) / 8U)
9#define ESEP_INFOSIZE 25 /* TODO unknown yet */ 9#define ESEP_INFOSIZE 25 /* TODO unknown yet */
10 10
11#define H48_ESIZE ((_12c4 * _8c4) << h) 11#define H48_ESIZE(h) ((_12c4 * _8c4) << (h))
12 12
13#define _esep_ind(i) (i / 8U) 13#define _esep_ind(i) (i / 8U)
14#define _esep_shift(i) (4U * (i % 8U)) 14#define _esep_shift(i) (4U * (i % 8U))
15#define _esep_mask(i) (((1U << 4U) - 1U) << _esep_shift(i)) 15#define _esep_mask(i) (((1U << 4U) - 1U) << _esep_shift(i))
16#define _visited_ind(i) (i / 8U) 16#define _visited_ind(i) (i / 8U)
17#define _visited_mask(i) (1U << (i % 8U)) 17#define _visited_mask(i) (1U << (i % 8U))
18 18
19typedef struct { 19typedef struct {
20 cube_fast_t cube; 20 cube_fast_t cube;
@@ -70,22 +70,26 @@ coord_h48(cube_fast_t c, const uint32_t *cocsepdata, uint8_t h)
70 esep = coord_fast_esep(d); 70 esep = coord_fast_esep(d);
71 eo = coord_fast_eo(d); 71 eo = coord_fast_eo(d);
72 72
73 ret = (coclass * H48_ESIZE) + (esep << h) + (eo >> (11-h)); 73 ret = (coclass * H48_ESIZE(h)) + (esep << h) + (eo >> (11-h));
74 74
75 return ret; 75 return ret;
76} 76}
77 77
78/*
79
80This function does not necessarily return a cube whose coordinate is
81the given value, because it works up to symmetry. This means that the
82returned cube is a transformed cube of one that gives the correct value.
83*/
78_static_inline cube_fast_t 84_static_inline cube_fast_t
79invcoord_h48(int64_t i, const cube_fast_t *crep, uint8_t h) 85invcoord_h48(int64_t i, const cube_fast_t *crep, uint8_t h) {
80{ 86 cube_fast_t ret; int64_t coclass, ee, esep, eo;
81 cube_fast_t ret;
82 int64_t coclass, ee, esep, eo;
83 87
84 DBG_ASSERT(h <= 11, cubetofast(zero), 88 DBG_ASSERT(h <= 11, cubetofast(zero),
85 "invcoord_h48: h must be between 0 and 11\n"); 89 "invcoord_h48: h must be between 0 and 11\n");
86 90
87 coclass = i / H48_ESIZE; 91 coclass = i / H48_ESIZE(h);
88 ee = i % H48_ESIZE; 92 ee = i % H48_ESIZE(h);
89 esep = ee >> h; 93 esep = ee >> h;
90 eo = (ee & ((1<<h)-1)) << (11-h); 94 eo = (ee & ((1<<h)-1)) << (11-h);
91 95

Generated with cgit - Back to sebastiano.tronto.net