nissy-classic

Stable branch of nissy
git clone https://git.tronto.net/nissy-classic
Download | Log | Files | Refs | README | LICENSE

commit 0df4f6f98101bb3be192ce892aa1452f2c6de1a4
parent 20ac0e60d7174114965d4419af0bb3028db8e447
Author: Sebastiano Tronto <sebastiano.tronto@gmail.com>
Date:   Wed, 17 Nov 2021 00:16:39 +0100

Use inttypes.h macros to print uint64_t variables (this requires -std=c99). Added a couple of TODOs

Diffstat:
MMakefile | 4++--
MTODO.md | 6++++++
Mnissy-2.0beta2.tar.gz | 0
Msrc/cubetypes.h | 2+-
Msrc/pruning.c | 16+++++++---------
Msrc/symcoord.c | 2+-
6 files changed, 17 insertions(+), 13 deletions(-)

diff --git 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 @@ -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 Binary files differ. diff --git a/src/cubetypes.h b/src/cubetypes.h @@ -2,7 +2,7 @@ #define CUBETYPES_H #include <stdbool.h> -#include <stdint.h> +#include <inttypes.h> #define NMOVES 55 /* Actually 55, but one is NULLMOVE */ #define NTRANS 48 diff --git 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 @@ -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");