commit ea5a61bfbe25779b1a51c76f6274262251c4da85 from: Sven M. Hallberg date: Wed Jul 29 17:29:31 2020 UTC oops, hash inp.p with the proper size commit - 6cf0b638631b1dc09719d468e537fc3a98cac8c3 commit + ea5a61bfbe25779b1a51c76f6274262251c4da85 blob - 740aa382d9ba714b62d2116f82c3eab4a942e2a3 blob + e1ea88b55ce1bef309b407422cf1c2a90fe37b49 --- minip_m.h +++ minip_m.h @@ -207,7 +207,7 @@ many1_(struct stream inp, struct cache *cac, void *env } #include /* strcmp */ -#include /* realloc */ +#include /* calloc */ #include /* UINT_MAX */ #include /* SIZE_MAX */ @@ -231,13 +231,13 @@ memo_(struct stream inp, struct cache *cache, void *en * two, we can run the intermediates modulo UINT_MAX+1. */ - /* hash (inp,sym) */ - for (i=0; i < sizeof inp; i++) + /* hash (pos,sym) */ + for (i=0; i < sizeof inp.p; i++) h0 = h0 * 33 + ((unsigned char *)&inp.p)[i]; for (i=0; sym[i] != '\0'; i++) h0 = h0 * 33 + (unsigned char)sym[i]; - /* look up (inp,sym) in cache and return if found */ + /* look up (pos,sym) in cache and return if found */ /* NB: count steps; the table could be filled with dummies */ for (i=0, h=h0, s=1; i < cache->capacity; i++, h+=s, s*=5) { mem = cache->table + (h % cache->capacity);