Lines Matching refs:nbperf

1 /*	$NetBSD: nbperf-chm.c,v 1.5 2021/01/26 21:25:55 joerg Exp $	*/
38 __RCSID("$NetBSD: nbperf-chm.c,v 1.5 2021/01/26 21:25:55 joerg Exp $");
46 #include "nbperf.h"
147 print_hash(struct nbperf *nbperf, struct state *state)
153 fprintf(nbperf->output, "#include <stdlib.h>\n\n");
155 fprintf(nbperf->output, "%suint32_t\n",
156 nbperf->static_hash ? "static " : "");
157 fprintf(nbperf->output,
159 nbperf->hash_name);
160 fprintf(nbperf->output, "{\n");
174 fprintf(nbperf->output, "\tstatic const %s g[%" PRId32 "] = {\n",
177 fprintf(nbperf->output, "%s0x%0*" PRIx32 ",%s",
183 fprintf(nbperf->output, "\n\t};\n");
185 fprintf(nbperf->output, "\t};\n");
186 fprintf(nbperf->output, "\tuint32_t h[%zu];\n\n", nbperf->hash_size);
187 (*nbperf->print_hash)(nbperf, "\t", "key", "keylen", "h");
189 fprintf(nbperf->output, "\n\th[0] = h[0] %% %" PRIu32 ";\n",
191 fprintf(nbperf->output, "\th[1] = h[1] %% %" PRIu32 ";\n",
194 fprintf(nbperf->output, "\th[2] = h[2] %% %" PRIu32 ";\n",
199 fprintf(nbperf->output, "\th[1] ^= (h[0] == h[1]);\n");
203 fprintf(nbperf->output,
205 fprintf(nbperf->output,
211 fprintf(nbperf->output, "\treturn (g[h[0]] + g[h[1]] + g[h[2]]) %% "
214 fprintf(nbperf->output, "\treturn (g[h[0]] + g[h[1]]) %% "
217 fprintf(nbperf->output, "}\n");
219 if (nbperf->map_output != NULL) {
221 fprintf(nbperf->map_output, "%" PRIu32 "\n", i);
227 chm3_compute(struct nbperf *nbperf)
229 chm_compute(struct nbperf *nbperf)
237 if (nbperf->c == 0)
238 nbperf-> c = 1.24;
240 if (nbperf->c < 1.24)
243 if (nbperf->hash_size < 3)
246 if (nbperf->c == 0)
247 nbperf-> c = 2;
249 if (nbperf->c < 2)
252 if (nbperf->hash_size < 2)
256 (*nbperf->seed_hash)(nbperf);
257 e = nbperf->n;
258 v = nbperf->c * nbperf->n;
260 if (v == 1.24 * nbperf->n)
264 if (nbperf->allow_hash_fudging)
267 if (v == 2 * nbperf->n)
269 if (nbperf->allow_hash_fudging)
279 if (SIZED2(_hash)(nbperf, &state.graph))
284 print_hash(nbperf, &state);