aboutsummaryrefslogtreecommitdiff
path: root/src/arch/portable.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/arch/portable.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/arch/portable.h')
-rw-r--r--src/arch/portable.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/arch/portable.h b/src/arch/portable.h
index 162ed1a..f1491f0 100644
--- a/src/arch/portable.h
+++ b/src/arch/portable.h
@@ -46,7 +46,7 @@ popcount_u64(uint64_t x)
46} 46}
47 47
48STATIC void 48STATIC void
49pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) 49pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)])
50{ 50{
51 memcpy(c, cube->corner, 8); 51 memcpy(c, cube->corner, 8);
52 memcpy(e, cube->edge, 12); 52 memcpy(e, cube->edge, 12);
@@ -166,7 +166,7 @@ inverse(cube_t cube)
166} 166}
167 167
168STATIC_INLINE void 168STATIC_INLINE void
169copy_co(cube_t cube[static 1], cube_t co) 169copy_co(cube_t cube[NON_NULL], cube_t co)
170{ 170{
171 uint8_t c; 171 uint8_t c;
172 size_t i; 172 size_t i;
@@ -291,19 +291,19 @@ invcoord_esep(uint64_t esep)
291} 291}
292 292
293STATIC_INLINE void 293STATIC_INLINE void
294copy_corners(cube_t dest[static 1], cube_t src) 294copy_corners(cube_t dest[NON_NULL], cube_t src)
295{ 295{
296 memcpy(&dest->corner, src.corner, sizeof(src.corner)); 296 memcpy(&dest->corner, src.corner, sizeof(src.corner));
297} 297}
298 298
299STATIC_INLINE void 299STATIC_INLINE void
300copy_edges(cube_t dest[static 1], cube_t src) 300copy_edges(cube_t dest[NON_NULL], cube_t src)
301{ 301{
302 memcpy(&dest->edge, src.edge, sizeof(src.edge)); 302 memcpy(&dest->edge, src.edge, sizeof(src.edge));
303} 303}
304 304
305STATIC_INLINE void 305STATIC_INLINE void
306set_eo(cube_t cube[static 1], uint64_t eo) 306set_eo(cube_t cube[NON_NULL], uint64_t eo)
307{ 307{
308 uint8_t i, sum, flip; 308 uint8_t i, sum, flip;
309 309

Generated with cgit - Back to sebastiano.tronto.net