From 0df4f6f98101bb3be192ce892aa1452f2c6de1a4 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Wed, 17 Nov 2021 00:16:39 +0100 Subject: Use inttypes.h macros to print uint64_t variables (this requires -std=c99). Added a couple of TODOs --- Makefile | 4 ++-- TODO.md | 6 ++++++ nissy-2.0beta2.tar.gz | Bin 51308 -> 51606 bytes src/cubetypes.h | 2 +- src/pruning.c | 16 +++++++--------- src/symcoord.c | 2 +- 6 files changed, 17 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 1e4d1c6..cb7b898 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ PREFIX = /usr/local MANPREFIX = ${PREFIX}/share/man CPPFLAGS = -DVERSION=\"${VERSION}\" -CFLAGS = -pedantic -Wall -Wextra -Wno-unused-parameter -O3 ${CPPFLAGS} -DBGFLAGS = -pedantic -Wall -Wextra -Wno-unused-parameter -g ${CPPFLAGS} +CFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -O3 ${CPPFLAGS} +DBGFLAGS = -std=c99 -pedantic -Wall -Wextra -Wno-unused-parameter -g ${CPPFLAGS} CC = cc diff --git a/TODO.md b/TODO.md index 4ccce22..0172dd8 100644 --- a/TODO.md +++ b/TODO.md @@ -34,12 +34,18 @@ It's more of a personal reminder than anything else. * make env.c compatible with Windows (and check that it works with BSD/MacOS) +* default to current directory for tables; this will work on any OS, up to + using the correct #ifdef guards to avoid checking for posix directories + in non-posix systems * better internal help page for each command (take it from man page) * better man page * find a better way to distribute the large tables, especially khuge ## Technical stuff +### Small fixes +* printf with stdint.h: use proper macros instead of %llu + ### Better pruning tables * Use pruning values mod 4 instead of mod 16 diff --git a/nissy-2.0beta2.tar.gz b/nissy-2.0beta2.tar.gz index 8143d58..9865c19 100644 Binary files a/nissy-2.0beta2.tar.gz and b/nissy-2.0beta2.tar.gz differ diff --git a/src/cubetypes.h b/src/cubetypes.h index 4997f3a..334662c 100644 --- a/src/cubetypes.h +++ b/src/cubetypes.h @@ -2,7 +2,7 @@ #define CUBETYPES_H #include -#include +#include #define NMOVES 55 /* Actually 55, but one is NULLMOVE */ #define NTRANS 48 diff --git a/src/pruning.c b/src/pruning.c index 11705c5..1369892 100644 --- a/src/pruning.c +++ b/src/pruning.c @@ -127,7 +127,8 @@ genptable(PruneData *pd) for (j = 0; j < pd->coord->max; j++) dfs_set_visited_index(&dd, j, false); genptable_dfs((Cube){0}, pd, &dd); - fprintf(stderr, "Depth %d done, generated %lu\t(%lu/%lu)\n", + fprintf(stderr, "Depth %d done, generated %" + PRIu64 "\t(%" PRIu64 "/%" PRIu64 ")\n", dd.d+1, pd->n - oldn, pd->n, pd->coord->max); oldn = pd->n; } @@ -169,12 +170,14 @@ genptable(PruneData *pd) ptable_update(pd, (Cube){0}, 0); pd->n = 1; oldn = 0; - fprintf(stderr, "Depth %d done, generated %lu\t(%lu/%lu)\n", + fprintf(stderr, "Depth %d done, generated %" + PRIu64 "\t(%" PRIu64 "/%" PRIu64 ")\n", 0, pd->n - oldn, pd->n, pd->coord->max); oldn = 1; for (d = 0; d < 15 && pd->n < pd->coord->max; d++) { genptable_bfs(pd, d, ms); - fprintf(stderr, "Depth %d done, generated %lu\t(%lu/%lu)\n", + fprintf(stderr, "Depth %d done, generated %" + PRIu64 "\t(%" PRIu64 "/%" PRIu64 ")\n", d+1, pd->n - oldn, pd->n, pd->coord->max); oldn = pd->n; } @@ -193,11 +196,6 @@ genptable_dfs(Cube c, PruneData *pd, DfsData *dd) Move mm; Cube cc; - if (pd->coord->index(c) > 2*ptablesize(pd)) { - printf("error! %lu > %lu\n", pd->coord->index(c), 2*ptablesize(pd)); - print_cube(c); - exit(1); - } pv = ptableval(pd, c); if (pv < dd->m || dd->m > dd->d) @@ -303,7 +301,7 @@ print_ptable(PruneData *pd) fprintf(stderr, "Values for table %s\n", pd->filename); for (i = 0; i < 16; i++) - printf("%2lu\t%10lu\n", i, a[i]); + printf("%2" PRIu64 "\t%10" PRIu64 "\n", i, a[i]); } uint64_t diff --git a/src/symcoord.c b/src/symcoord.c index e9374d7..798a946 100644 --- a/src/symcoord.c +++ b/src/symcoord.c @@ -286,7 +286,7 @@ gensym(SymData *sd) sd->rep = realloc(sd->rep, nreps * sizeof(Cube)); sd->generated = true; - fprintf(stderr, "Found %lu classes\n", nreps); + fprintf(stderr, "Found %" PRIu64 " classes\n", nreps); if (!write_symdata_file(sd)) fprintf(stderr, "Error writing SymData file\n"); -- cgit v1.3