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/avx2.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/avx2.h')
| -rw-r--r-- | src/arch/avx2.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/arch/avx2.h b/src/arch/avx2.h index 15ce02a..801419e 100644 --- a/src/arch/avx2.h +++ b/src/arch/avx2.h | |||
| @@ -37,11 +37,11 @@ popcount_u32(uint32_t x) | |||
| 37 | STATIC_INLINE int | 37 | STATIC_INLINE int |
| 38 | popcount_u64(uint64_t x) | 38 | popcount_u64(uint64_t x) |
| 39 | { | 39 | { |
| 40 | return _mm_popcnt_u64(x); | 40 | return (int)_mm_popcnt_u64(x); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | STATIC void | 43 | STATIC void |
| 44 | pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) | 44 | pieces(cube_t cube[NON_NULL], uint8_t c[SIZE(8)], uint8_t e[SIZE(12)]) |
| 45 | { | 45 | { |
| 46 | uint8_t aux[32]; | 46 | uint8_t aux[32]; |
| 47 | 47 | ||
| @@ -167,7 +167,7 @@ coord_co(cube_t c) | |||
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | STATIC_INLINE void | 169 | STATIC_INLINE void |
| 170 | copy_co(cube_t cube[static 1], cube_t co) | 170 | copy_co(cube_t cube[NON_NULL], cube_t co) |
| 171 | { | 171 | { |
| 172 | cube_t coclean; | 172 | cube_t coclean; |
| 173 | 173 | ||
| @@ -274,19 +274,19 @@ invcoord_esep(uint64_t esep) | |||
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | STATIC_INLINE void | 276 | STATIC_INLINE void |
| 277 | copy_corners(cube_t dest[static 1], cube_t src) | 277 | copy_corners(cube_t dest[NON_NULL], cube_t src) |
| 278 | { | 278 | { |
| 279 | *dest = _mm256_blend_epi32(*dest, src, 0x0F); | 279 | *dest = _mm256_blend_epi32(*dest, src, 0x0F); |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | STATIC_INLINE void | 282 | STATIC_INLINE void |
| 283 | copy_edges(cube_t dest[static 1], cube_t src) | 283 | copy_edges(cube_t dest[NON_NULL], cube_t src) |
| 284 | { | 284 | { |
| 285 | *dest = _mm256_blend_epi32(*dest, src, 0xF0); | 285 | *dest = _mm256_blend_epi32(*dest, src, 0xF0); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | STATIC_INLINE void | 288 | STATIC_INLINE void |
| 289 | set_eo(cube_t cube[static 1], uint64_t eo) | 289 | set_eo(cube_t cube[NON_NULL], uint64_t eo) |
| 290 | { | 290 | { |
| 291 | uint64_t eo12, eotop, eobot; | 291 | uint64_t eo12, eotop, eobot; |
| 292 | __m256i veo; | 292 | __m256i veo; |
