aboutsummaryrefslogtreecommitdiff
path: root/test/010_math_permtoindex/permtoindex_tests.c
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 /test/010_math_permtoindex/permtoindex_tests.c
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 'test/010_math_permtoindex/permtoindex_tests.c')
-rw-r--r--test/010_math_permtoindex/permtoindex_tests.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/010_math_permtoindex/permtoindex_tests.c b/test/010_math_permtoindex/permtoindex_tests.c
index f246ef3..2a7ecf3 100644
--- a/test/010_math_permtoindex/permtoindex_tests.c
+++ b/test/010_math_permtoindex/permtoindex_tests.c
@@ -1,6 +1,6 @@
1#include "../test.h" 1#include "../test.h"
2 2
3uint64_t permtoindex(size_t n, const uint8_t [n]); 3uint64_t permtoindex(size_t n, const uint8_t *);
4 4
5void run(void) { 5void run(void) {
6 char str[STRLENMAX]; 6 char str[STRLENMAX];
@@ -11,7 +11,7 @@ void run(void) {
11 n = atoll(str); 11 n = atoll(str);
12 for (i = 0; i < n; i++) { 12 for (i = 0; i < n; i++) {
13 fgets(str, STRLENMAX, stdin); 13 fgets(str, STRLENMAX, stdin);
14 a[i] = atoi(str); 14 a[i] = (uint8_t)atoi(str);
15 } 15 }
16 16
17 p = permtoindex(n, a); 17 p = permtoindex(n, a);

Generated with cgit - Back to sebastiano.tronto.net