diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-05 08:53:38 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2024-09-05 08:55:25 +0200 |
| commit | fd5ddb3db9f50411ca579d84f225f265ca35b56a (patch) | |
| tree | b659112cc0e2abd6c7edb08b0938c0d2de4ca066 /src/solvers/h48/gendata_h48.h | |
| parent | c9e2d6466e42d6b779ac9ffa7c5ee9a9c7558df8 (diff) | |
| download | nissy-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.h | 48 |
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); | 77 | STATIC_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); | 78 | STATIC_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 *); | 80 | STATIC uint64_t gen_h48short(gendata_h48short_arg_t *); |
| 81 | _static size_t gendata_h48(gendata_h48_arg_t *); | 81 | STATIC size_t gendata_h48(gendata_h48_arg_t *); |
| 82 | _static size_t gendata_h48h0k4(gendata_h48_arg_t *); | 82 | STATIC size_t gendata_h48h0k4(gendata_h48_arg_t *); |
| 83 | _static int64_t gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *); | 83 | STATIC int64_t gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *); |
| 84 | _static int64_t gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *); | 84 | STATIC int64_t gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *); |
| 85 | _static int64_t gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *); | 85 | STATIC int64_t gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *); |
| 86 | _static size_t gendata_h48k2(gendata_h48_arg_t *); | 86 | STATIC size_t gendata_h48k2(gendata_h48_arg_t *); |
| 87 | _static void gendata_h48k2_dfs(h48k2_dfs_arg_t *arg); | 87 | STATIC 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 *); | 89 | STATIC_INLINE int8_t get_h48_bound(cube_t, uint32_t, uint8_t, uint8_t, uint32_t *); |
| 90 | 90 | ||
| 91 | _static uint64_t | 91 | STATIC uint64_t |
| 92 | gen_h48short(gendata_h48short_arg_t *arg) | 92 | gen_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 | 132 | STATIC size_t |
| 133 | gendata_h48(gendata_h48_arg_t *arg) | 133 | gendata_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) | |||
| 164 | TODO description | 164 | TODO description |
| 165 | generating fixed table with h=0, k=4 | 165 | generating fixed table with h=0, k=4 |
| 166 | */ | 166 | */ |
| 167 | _static size_t | 167 | STATIC size_t |
| 168 | gendata_h48h0k4(gendata_h48_arg_t *arg) | 168 | gendata_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 | 211 | STATIC int64_t |
| 212 | gendata_h48h0k4_bfs(h48h0k4_bfs_arg_t *arg) | 212 | gendata_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 | 222 | STATIC int64_t |
| 223 | gendata_h48h0k4_bfs_fromdone(h48h0k4_bfs_arg_t *arg) | 223 | gendata_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 | 252 | STATIC int64_t |
| 253 | gendata_h48h0k4_bfs_fromnew(h48h0k4_bfs_arg_t *arg) | 253 | gendata_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 | 284 | STATIC size_t |
| 285 | gendata_h48k2(gendata_h48_arg_t *arg) | 285 | gendata_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 | 366 | STATIC void |
| 367 | gendata_h48k2_dfs(h48k2_dfs_arg_t *arg) | 367 | gendata_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 | 409 | STATIC_INLINE uint8_t |
| 410 | get_esep_pval(const uint32_t *buf32, int64_t i, uint8_t k) | 410 | get_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 | 415 | STATIC_INLINE void |
| 416 | set_esep_pval(uint32_t *buf32, int64_t i, uint8_t k, uint8_t val) | 416 | set_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 | 422 | STATIC_INLINE int8_t |
| 423 | get_h48_bound(cube_t cube, uint32_t cdata, uint8_t h, uint8_t k, uint32_t *h48data) | 423 | get_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; |
