On Tue, Sep 11, 2018 at 17:46:41 -0700, Richard Henderson wrote: > On 09/10/2018 11:58 AM, Emilio G. Cota wrote: > > @@ -289,7 +297,9 @@ static void htable_init(void) > > /* avoid allocating memory later by allocating all the keys now */ > > keys = g_malloc(sizeof(*keys) * n); > > for (i = 0; i < n; i++) { > > - keys[i] = populate_offset + i; > > + long val = populate_offset + i; > > + > > + keys[i] = precompute_hash ? h(val) : hval(val); > > hfunc?
Here is where precomputation happens, so if precompute_hash is set, then we insert the hashed value. Otherwise we insert the non-hashed value (with hval()). In all other instances we use hfunc, since hfunc is set to the "other" hash function wrt the above--see this later hunk: @@ -451,6 +461,10 @@ static void parse_args(int argc, char *argv[]) case 'o': populate_offset = atol(optarg); break; + case 'p': + precompute_hash = true; + hfunc = hval; + break; Thanks, Emilio