aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/gendata_eoesep.h
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-04-06 15:55:33 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-04-06 15:55:33 +0200
commitfc41f7917531693680b5baf71ffe38c47333fe84 (patch)
treea6e62232e05e7779034c5f9d1bf743b6f1c198e3 /src/solvers/h48/gendata_eoesep.h
parentfe534f1497da6447153064d7bba00243000f803b (diff)
downloadnissy-core-fc41f7917531693680b5baf71ffe38c47333fe84.tar.gz
nissy-core-fc41f7917531693680b5baf71ffe38c47333fe84.zip
Make the project build with Microsoft's broken C compiler.
MSVC is not fully C11-compliant, even when compiling with /std:c11. Some changes were needed to make the codebase compatible. Notably, the notation a[static N] and a[n] for function parameters of array type is not supported, so that had to be hidden behind a macro. Atomic types are also an experimental feature, apparently, but at least they work with the correct compiler flag. One thing that MSVC does well, however, is warning on integer conversions on /W4 level. I am not sure if Clang and GCC have something similar, so I took this chance to fix some of these.
Diffstat (limited to 'src/solvers/h48/gendata_eoesep.h')
-rw-r--r--src/solvers/h48/gendata_eoesep.h62
1 files changed, 32 insertions, 30 deletions
diff --git a/src/solvers/h48/gendata_eoesep.h b/src/solvers/h48/gendata_eoesep.h
index e9a2794..81bbd43 100644
--- a/src/solvers/h48/gendata_eoesep.h
+++ b/src/solvers/h48/gendata_eoesep.h
@@ -1,25 +1,25 @@
1STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [static ESEP_MAX]); 1STATIC uint64_t coord_eoesep_sym(cube_t, const uint32_t [SIZE(ESEP_MAX)]);
2STATIC size_t gendata_esep_classes( 2STATIC size_t gendata_esep_classes(
3 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); 3 uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]);
4STATIC size_t gendata_eoesep(unsigned char *, uint8_t); 4STATIC size_t gendata_eoesep(unsigned char *, uint8_t);
5STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [static EOESEP_BUF], 5STATIC uint32_t gendata_eoesep_bfs(uint8_t, uint8_t [SIZE(EOESEP_BUF)],
6 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); 6 uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]);
7STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [static EOESEP_BUF], 7STATIC uint32_t gendata_eoesep_fromnew(uint8_t, uint8_t [SIZE(EOESEP_BUF)],
8 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); 8 uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]);
9STATIC uint32_t gendata_eoesep_fromdone(uint8_t, uint8_t [static EOESEP_BUF], 9STATIC uint32_t gendata_eoesep_fromdone(uint8_t, uint8_t [SIZE(EOESEP_BUF)],
10 uint32_t [static ESEP_MAX], uint16_t [static ESEP_CLASSES]); 10 uint32_t [SIZE(ESEP_MAX)], uint16_t [SIZE(ESEP_CLASSES)]);
11STATIC uint32_t gendata_eoesep_marksim(uint64_t, uint8_t, 11STATIC uint32_t gendata_eoesep_marksim(uint64_t, uint8_t,
12 uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); 12 uint8_t [SIZE(EOESEP_BUF)], uint32_t [SIZE(ESEP_MAX)]);
13STATIC bool gendata_eoesep_next(cube_t, uint8_t, 13STATIC bool gendata_eoesep_next(cube_t, uint8_t,
14 uint8_t [static EOESEP_BUF], uint32_t [static ESEP_MAX]); 14 uint8_t [SIZE(EOESEP_BUF)], uint32_t [SIZE(ESEP_MAX)]);
15STATIC uint8_t get_eoesep_pval( 15STATIC uint8_t get_eoesep_pval(
16 const uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], uint64_t); 16 const uint8_t [SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))], uint64_t);
17STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t); 17STATIC uint8_t get_eoesep_pval_cube(const unsigned char *, cube_t);
18STATIC void set_eoesep_pval( 18STATIC void set_eoesep_pval(
19 uint8_t [static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], uint64_t, uint8_t); 19 uint8_t [SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))], uint64_t, uint8_t);
20 20
21STATIC uint64_t 21STATIC uint64_t
22coord_eoesep_sym(cube_t c, const uint32_t esep_classes[static ESEP_MAX]) 22coord_eoesep_sym(cube_t c, const uint32_t esep_classes[SIZE(ESEP_MAX)])
23{ 23{
24 uint8_t ttrep; 24 uint8_t ttrep;
25 uint32_t edata, class; 25 uint32_t edata, class;
@@ -36,8 +36,8 @@ coord_eoesep_sym(cube_t c, const uint32_t esep_classes[static ESEP_MAX])
36 36
37STATIC size_t 37STATIC size_t
38gendata_esep_classes( 38gendata_esep_classes(
39 uint32_t esep_classes[static ESEP_MAX], 39 uint32_t esep_classes[SIZE(ESEP_MAX)],
40 uint16_t rep[static ESEP_CLASSES] 40 uint16_t rep[SIZE(ESEP_CLASSES)]
41) 41)
42{ 42{
43 bool visited[ESEP_MAX]; 43 bool visited[ESEP_MAX];
@@ -59,7 +59,7 @@ gendata_esep_classes(
59 esep_classes[j] = cl | ti; 59 esep_classes[j] = cl | ti;
60 visited[j] = true; 60 visited[j] = true;
61 } 61 }
62 rep[class] = i; 62 rep[class] = (uint16_t)i;
63 class++; 63 class++;
64 } 64 }
65 65
@@ -121,8 +121,8 @@ STATIC uint32_t
121gendata_eoesep_bfs( 121gendata_eoesep_bfs(
122 uint8_t d, 122 uint8_t d,
123 uint8_t buf8[EOESEP_BUF], 123 uint8_t buf8[EOESEP_BUF],
124 uint32_t esep_classes[static ESEP_MAX], 124 uint32_t esep_classes[SIZE(ESEP_MAX)],
125 uint16_t rep[static ESEP_CLASSES] 125 uint16_t rep[SIZE(ESEP_CLASSES)]
126) 126)
127{ 127{
128 if (d < 9) 128 if (d < 9)
@@ -135,12 +135,13 @@ STATIC uint32_t
135gendata_eoesep_fromdone( 135gendata_eoesep_fromdone(
136 uint8_t d, 136 uint8_t d,
137 uint8_t buf8[EOESEP_BUF], 137 uint8_t buf8[EOESEP_BUF],
138 uint32_t esep_classes[static ESEP_MAX], 138 uint32_t esep_classes[SIZE(ESEP_MAX)],
139 uint16_t rep[static ESEP_CLASSES] 139 uint16_t rep[SIZE(ESEP_CLASSES)]
140) 140)
141{ 141{
142 uint8_t pval; 142 uint8_t pval;
143 uint64_t i, esep, eo, coord, done; 143 uint32_t done;
144 uint64_t i, esep, eo, coord;
144 145
145 done = 0; 146 done = 0;
146 for (i = 0; i < ESEP_CLASSES; i++) { 147 for (i = 0; i < ESEP_CLASSES; i++) {
@@ -164,12 +165,13 @@ STATIC uint32_t
164gendata_eoesep_fromnew( 165gendata_eoesep_fromnew(
165 uint8_t d, 166 uint8_t d,
166 uint8_t buf8[EOESEP_BUF], 167 uint8_t buf8[EOESEP_BUF],
167 uint32_t esep_classes[static ESEP_MAX], 168 uint32_t esep_classes[SIZE(ESEP_MAX)],
168 uint16_t rep[static ESEP_CLASSES] 169 uint16_t rep[SIZE(ESEP_CLASSES)]
169) 170)
170{ 171{
171 uint8_t pval; 172 uint8_t pval;
172 uint64_t i, esep, eo, coord, done; 173 uint32_t done;
174 uint64_t i, esep, eo, coord;
173 cube_t c; 175 cube_t c;
174 176
175 done = 0; 177 done = 0;
@@ -196,8 +198,8 @@ STATIC uint32_t
196gendata_eoesep_marksim( 198gendata_eoesep_marksim(
197 uint64_t i, 199 uint64_t i,
198 uint8_t d, 200 uint8_t d,
199 uint8_t buf8[static EOESEP_BUF], 201 uint8_t buf8[SIZE(EOESEP_BUF)],
200 uint32_t esep_classes[static ESEP_MAX] 202 uint32_t esep_classes[SIZE(ESEP_MAX)]
201) 203)
202{ 204{
203 uint8_t t, m, pval; 205 uint8_t t, m, pval;
@@ -227,8 +229,8 @@ STATIC bool
227gendata_eoesep_next( 229gendata_eoesep_next(
228 cube_t c, 230 cube_t c,
229 uint8_t d, 231 uint8_t d,
230 uint8_t buf8[static EOESEP_BUF], 232 uint8_t buf8[SIZE(EOESEP_BUF)],
231 uint32_t esep_classes[static ESEP_MAX] 233 uint32_t esep_classes[SIZE(ESEP_MAX)]
232) 234)
233{ 235{
234 uint8_t m, t, pval; 236 uint8_t m, t, pval;
@@ -251,7 +253,7 @@ gendata_eoesep_next(
251 253
252STATIC uint8_t 254STATIC uint8_t
253get_eoesep_pval( 255get_eoesep_pval(
254 const uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], 256 const uint8_t table[SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))],
255 uint64_t i 257 uint64_t i
256) 258)
257{ 259{
@@ -270,7 +272,7 @@ get_eoesep_pval_cube(const unsigned char *data, cube_t c)
270 272
271STATIC void 273STATIC void
272set_eoesep_pval( 274set_eoesep_pval(
273 uint8_t table[static DIV_ROUND_UP(EOESEP_TABLESIZE, 2)], 275 uint8_t table[SIZE(DIV_ROUND_UP(EOESEP_TABLESIZE, 2))],
274 uint64_t i, 276 uint64_t i,
275 uint8_t val 277 uint8_t val
276) 278)

Generated with cgit - Back to sebastiano.tronto.net