aboutsummaryrefslogtreecommitdiff
path: root/src/core/cube.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/core/cube.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 '')
-rw-r--r--src/core/cube.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/cube.h b/src/core/cube.h
index 9e79dda..1c21ce1 100644
--- a/src/core/cube.h
+++ b/src/core/cube.h
@@ -1,6 +1,6 @@
1STATIC bool cube_true(cube_t); 1STATIC bool cube_true(cube_t);
2 2
3STATIC cube_t cubefromarray(uint8_t [static 8], uint8_t [static 12]); 3STATIC cube_t cubefromarray(uint8_t [SIZE(8)], uint8_t [SIZE(12)]);
4STATIC bool isconsistent(oriented_cube_t); 4STATIC bool isconsistent(oriented_cube_t);
5STATIC bool issolvable(oriented_cube_t); 5STATIC bool issolvable(oriented_cube_t);
6STATIC bool issolved(oriented_cube_t); 6STATIC bool issolved(oriented_cube_t);
@@ -10,7 +10,7 @@ STATIC void getcube_fix(long long *, long long *,
10STATIC cube_t getcube(uint64_t, uint64_t, uint64_t, uint64_t); 10STATIC cube_t getcube(uint64_t, uint64_t, uint64_t, uint64_t);
11 11
12STATIC oriented_cube_t readcube(const char *); 12STATIC oriented_cube_t readcube(const char *);
13STATIC int64_t writecube(oriented_cube_t, size_t n, char [n]); 13STATIC int64_t writecube(oriented_cube_t, size_t n, char *);
14STATIC uint8_t readco(const char *); 14STATIC uint8_t readco(const char *);
15STATIC uint8_t readcp(const char *); 15STATIC uint8_t readcp(const char *);
16STATIC uint8_t readeo(const char *); 16STATIC uint8_t readeo(const char *);
@@ -29,7 +29,7 @@ cube_true(cube_t cube)
29} 29}
30 30
31STATIC cube_t 31STATIC cube_t
32cubefromarray(uint8_t c[static 8], uint8_t e[static 12]) 32cubefromarray(uint8_t c[SIZE(8)], uint8_t e[SIZE(12)])
33{ 33{
34 return STATIC_CUBE( 34 return STATIC_CUBE(
35 c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], 35 c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7],
@@ -304,7 +304,7 @@ readcube(const char *buf)
304} 304}
305 305
306STATIC int64_t 306STATIC int64_t
307writecube(oriented_cube_t cube, size_t buf_size, char buf[buf_size]) 307writecube(oriented_cube_t cube, size_t buf_size, char *buf)
308{ 308{
309 int i; 309 int i;
310 uint8_t corner[8], edge[12]; 310 uint8_t corner[8], edge[12];

Generated with cgit - Back to sebastiano.tronto.net