diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 15:55:33 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2026-04-06 15:55:33 +0200 |
| commit | fc41f7917531693680b5baf71ffe38c47333fe84 (patch) | |
| tree | a6e62232e05e7779034c5f9d1bf743b6f1c198e3 /src/solvers/h48/gendata_cocsep.h | |
| parent | fe534f1497da6447153064d7bba00243000f803b (diff) | |
| download | nissy-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.h | 21 |
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 @@ | |||
| 1 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); | 1 | STATIC size_t gendata_cocsep(unsigned char *, uint64_t *, cube_t *); |
| 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [static 1]); | 2 | STATIC uint32_t gendata_cocsep_dfs(cocsep_dfs_arg_t [NON_NULL]); |
| 3 | 3 | ||
| 4 | STATIC_INLINE bool gendata_cocsep_get_visited( | 4 | STATIC_INLINE bool gendata_cocsep_get_visited( |
| 5 | const uint8_t [static COCSEP_VISITEDSIZE], uint64_t); | 5 | const uint8_t [SIZE(COCSEP_VISITEDSIZE)], uint64_t); |
| 6 | STATIC_INLINE void gendata_cocsep_set_visited( | 6 | STATIC_INLINE void gendata_cocsep_set_visited( |
| 7 | uint8_t [static COCSEP_VISITEDSIZE], uint64_t); | 7 | uint8_t [SIZE(COCSEP_VISITEDSIZE)], uint64_t); |
| 8 | 8 | ||
| 9 | STATIC_INLINE int8_t get_h48_cdata( | 9 | STATIC_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 | ||
| 12 | STATIC size_t | 12 | STATIC size_t |
| 13 | gendata_cocsep( | 13 | gendata_cocsep( |
| @@ -79,11 +79,10 @@ gendata_cocsep_return_size: | |||
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | STATIC uint32_t | 81 | STATIC uint32_t |
| 82 | gendata_cocsep_dfs(cocsep_dfs_arg_t arg[static 1]) | 82 | gendata_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 | ||
| 136 | STATIC_INLINE bool | 135 | STATIC_INLINE bool |
| 137 | gendata_cocsep_get_visited( | 136 | gendata_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 | ||
| 145 | STATIC_INLINE void | 144 | STATIC_INLINE void |
| 146 | gendata_cocsep_set_visited( | 145 | gendata_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( | |||
| 154 | STATIC_INLINE int8_t | 153 | STATIC_INLINE int8_t |
| 155 | get_h48_cdata( | 154 | get_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 | { |
