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/arch/common.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/arch/common.h')
| -rw-r--r-- | src/arch/common.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/arch/common.h b/src/arch/common.h index 2b95fe3..a7c4a3b 100644 --- a/src/arch/common.h +++ b/src/arch/common.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | STATIC_INLINE int popcount_u32(uint32_t); | 15 | STATIC_INLINE int popcount_u32(uint32_t); |
| 16 | STATIC_INLINE int popcount_u64(uint64_t); | 16 | STATIC_INLINE int popcount_u64(uint64_t); |
| 17 | 17 | ||
| 18 | STATIC void pieces(cube_t [static 1], uint8_t [static 8], uint8_t [static 12]); | 18 | STATIC void pieces(cube_t [NON_NULL], uint8_t [SIZE(8)], uint8_t [SIZE(12)]); |
| 19 | STATIC_INLINE bool equal(cube_t, cube_t); | 19 | STATIC_INLINE bool equal(cube_t, cube_t); |
| 20 | STATIC_INLINE cube_t invertco(cube_t); | 20 | STATIC_INLINE cube_t invertco(cube_t); |
| 21 | STATIC_INLINE cube_t compose_edges(cube_t, cube_t); | 21 | STATIC_INLINE cube_t compose_edges(cube_t, cube_t); |
| @@ -35,12 +35,12 @@ STATIC_INLINE cube_t invcoord_epudsep(uint64_t); | |||
| 35 | 35 | ||
| 36 | STATIC_INLINE bool is_eo_even(cube_t); | 36 | STATIC_INLINE bool is_eo_even(cube_t); |
| 37 | 37 | ||
| 38 | STATIC_INLINE void copy_corners(cube_t [static 1], cube_t); | 38 | STATIC_INLINE void copy_corners(cube_t [NON_NULL], cube_t); |
| 39 | STATIC_INLINE void copy_co(cube_t [static 1], cube_t); | 39 | STATIC_INLINE void copy_co(cube_t [NON_NULL], cube_t); |
| 40 | STATIC_INLINE void copy_edges(cube_t [static 1], cube_t); | 40 | STATIC_INLINE void copy_edges(cube_t [NON_NULL], cube_t); |
| 41 | STATIC_INLINE void set_eo(cube_t [static 1], uint64_t); | 41 | STATIC_INLINE void set_eo(cube_t [NON_NULL], uint64_t); |
| 42 | 42 | ||
| 43 | STATIC_INLINE void invcoord_esep_array(uint64_t, uint64_t, uint8_t[static 12]); | 43 | STATIC_INLINE void invcoord_esep_array(uint64_t, uint64_t, uint8_t[SIZE(12)]); |
| 44 | STATIC_INLINE cube_t invcoord_eoesep(uint64_t); | 44 | STATIC_INLINE cube_t invcoord_eoesep(uint64_t); |
| 45 | STATIC_INLINE uint64_t coord_epudsep_array(const uint8_t [8]); | 45 | STATIC_INLINE uint64_t coord_epudsep_array(const uint8_t [8]); |
| 46 | STATIC_INLINE void invcoord_epudsep_array(uint64_t, uint8_t [8]); | 46 | STATIC_INLINE void invcoord_epudsep_array(uint64_t, uint8_t [8]); |
| @@ -53,7 +53,7 @@ STATIC_INLINE uint64_t coord_epe(cube_t); | |||
| 53 | STATIC_INLINE cube_t invcoord_epe(uint64_t); | 53 | STATIC_INLINE cube_t invcoord_epe(uint64_t); |
| 54 | 54 | ||
| 55 | STATIC_INLINE void | 55 | STATIC_INLINE void |
| 56 | invcoord_esep_array(uint64_t set1, uint64_t set2, uint8_t mem[static 12]) | 56 | invcoord_esep_array(uint64_t set1, uint64_t set2, uint8_t mem[SIZE(12)]) |
| 57 | { | 57 | { |
| 58 | uint64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1; | 58 | uint64_t bit1, bit2, i, j, jj, k, l, s, v, w, is1; |
| 59 | uint8_t slice[3] = {0}; | 59 | uint8_t slice[3] = {0}; |
