aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/h48/gendata_cocsep.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_cocsep.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_cocsep.h')
-rw-r--r--src/solvers/h48/gendata_cocsep.h21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/solvers/h48/gendata_cocsep.h b/src/solvers/h48/gendata_cocsep.h
index db7ac95..f83207b 100644
--- a/src/solvers/h48/gendata_cocsep.h
+++ b/src/solvers/h48/gendata_cocsep.h
@@ -1,13 +1,13 @@
1STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); 1STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *);
2STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); 2STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [NON_NULL]);
3 3
4STATIC_INLINE bool gendata_cocsep_get_visited( 4STATIC_INLINE bool gendata_cocsep_get_visited(
5 const uint8_t [static COCSEP_VISITEDSIZE], uint64_t); 5 const uint8_t [SIZE(COCSEP_VISITEDSIZE)], uint64_t);
6STATIC_INLINE void gendata_cocsep_set_visited( 6STATIC_INLINE void gendata_cocsep_set_visited(
7 uint8_t [static COCSEP_VISITEDSIZE], uint64_t); 7 uint8_t [SIZE(COCSEP_VISITEDSIZE)], uint64_t);
8 8
9STATIC_INLINE int8_t get_h48_cdata( 9STATIC_INLINE int8_t get_h48_cdata(
10 cube_t, const uint32_t [static COCSEP_TABLESIZE], uint32_t *); 10 cube_t, const uint32_t [SIZE(COCSEP_TABLESIZE)], uint32_t *);
11 11
12STATIC size_t 12STATIC size_t
13gendata_cocsep( 13gendata_cocsep(
@@ -79,11 +79,10 @@ gendata_cocsep_return_size:
79} 79}
80 80
81STATIC uint32_t 81STATIC uint32_t
82gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) 82gendata_cocsep_dfs(cocsep_dfs_arg_t arg[NON_NULL])
83{ 83{
84 uint8_t m; 84 uint8_t m, t;
85 uint32_t cc, class, ttrep, depth, olddepth, tinv; 85 uint32_t cc, class, ttrep, depth, olddepth, tinv;
86 uint64_t t;
87 uint64_t i, j; 86 uint64_t i, j;
88 cube_t d; 87 cube_t d;
89 cocsep_dfs_arg_t nextarg; 88 cocsep_dfs_arg_t nextarg;
@@ -105,7 +104,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1])
105 d = transform_corners(arg->cube, t); 104 d = transform_corners(arg->cube, t);
106 j = coord_cocsep(d); 105 j = coord_cocsep(d);
107 if (i == j && arg->selfsim != NULL) 106 if (i == j && arg->selfsim != NULL)
108 arg->selfsim[*arg->n] |= UINT64_C(1) << t; 107 arg->selfsim[*arg->n] |= UINT64_C(1) << (uint64_t)t;
109 if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF)) 108 if (COCLASS(arg->buf32[j]) != UINT32_C(0xFFFF))
110 continue; 109 continue;
111 gendata_cocsep_set_visited(arg->visited, j); 110 gendata_cocsep_set_visited(arg->visited, j);
@@ -135,7 +134,7 @@ gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1])
135 134
136STATIC_INLINE bool 135STATIC_INLINE bool
137gendata_cocsep_get_visited( 136gendata_cocsep_get_visited(
138 const uint8_t a[static COCSEP_VISITEDSIZE], 137 const uint8_t a[SIZE(COCSEP_VISITEDSIZE)],
139 uint64_t i 138 uint64_t i
140) 139)
141{ 140{
@@ -144,7 +143,7 @@ gendata_cocsep_get_visited(
144 143
145STATIC_INLINE void 144STATIC_INLINE void
146gendata_cocsep_set_visited( 145gendata_cocsep_set_visited(
147 uint8_t a[static COCSEP_VISITEDSIZE], 146 uint8_t a[SIZE(COCSEP_VISITEDSIZE)],
148 uint64_t i 147 uint64_t i
149) 148)
150{ 149{
@@ -154,7 +153,7 @@ gendata_cocsep_set_visited(
154STATIC_INLINE int8_t 153STATIC_INLINE int8_t
155get_h48_cdata( 154get_h48_cdata(
156 cube_t cube, 155 cube_t cube,
157 const uint32_t cocsepdata[static COCSEP_TABLESIZE], 156 const uint32_t cocsepdata[SIZE(COCSEP_TABLESIZE)],
158 uint32_t *cdata 157 uint32_t *cdata
159) 158)
160{ 159{

Generated with cgit - Back to sebastiano.tronto.net