nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

commit b36ed11e322152ff9ab813af78a08c35b42d5f94
parent a7c65451347692455f746f498f0205a7ecdd9cac
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Mon, 11 Aug 2025 17:24:01 +0200

Made H48 solver safer for 32bit size_t

Diffstat:
Msrc/solvers/h48/utils.h | 11+++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/solvers/h48/utils.h b/src/solvers/h48/utils.h @@ -1,3 +1,9 @@ +#if SIZE_MAX == UINT64_MAX +#define H48_HMAX UINT8_C(11) +#else +#define H48_HMAX UINT8_C(7) +#endif + long long parse_h48_hk( const char *, uint8_t [static 1], uint8_t [static 1]); STATIC long long dataid_h48(const char *, char [static NISSY_SIZE_DATAID]); @@ -18,8 +24,9 @@ parse_h48_hk(const char *buf, uint8_t h[static 1], uint8_t k[static 1]) buf++; *h = atoi(buf); - if (*h > 11) { - LOG("[H48] Invalid value %" PRIu8 " for parameter h\n", *h); + if (*h > H48_HMAX) { + LOG("[H48] Invalid value %" PRIu8 " for parameter h (must be " + "at most %" PRIu8 ")\n", *h, H48_HMAX); goto parse_h48_hk_error; }