aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/gendata_h48.h
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/h48/gendata_h48.h
parentc9e2d6466e42d6b779ac9ffa7c5ee9a9c7558df8 (diff)
downloadnissy-core-fd5ddb3db9f50411ca579d84f225f265ca35b56a.tar.gz
nissy-core-fd5ddb3db9f50411ca579d84f225f265ca35b56a.zip
Rename constants from _underscore to CAPS
Diffstat (limited to 'src/solvers/h48/gendata_h48.h')
-rw-r--r--src/solvers/h48/gendata_h48.h48
1 files changed, 24 insertions, 24 deletions
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;

Generated with cgit - Back to sebastiano.tronto.net