0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bmz-test.c
Go to the documentation of this file.
1 
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include <string.h>
23 #include <sys/stat.h>
24 #include <errno.h>
25 #include <fcntl.h>
26 #include <unistd.h>
27 #include "bmz-internal.h"
28 #include "test-helper.h"
29 #ifndef HT_NO_MMAP
30 #include <sys/mman.h>
31 static size_t s_no_mmap = 0;
32 #else
33 static size_t s_no_mmap = 1;
34 #endif
35 
36 #pragma GCC diagnostic ignored "-Wpedantic"
37 
38 /* To silence warnings in format strings */
39 typedef long unsigned Lu;
40 
41 #define TIMES(_n_, _code_) do { \
42  size_t _n = _n_; \
43  while (_n--) { _code_; } \
44 } while (0)
45 
46 #define BENCH(_label_, _code_, _n_, _times_) do { \
47  double t1; \
48  HT_MEASURE(t1, TIMES(_times_, _code_)); \
49  printf("%16s: %.3fs (%.3fMB/s)\n", \
50  _label_, t1, (_n_) / 1e6 / t1 *(_times_)); \
51  fflush(stdout); fflush(stderr); \
52 } while (0)
53 
54 #define LOG(_lvl_, _fmt_, ...) if (s_verbosity >= _lvl_) do { \
55  fprintf(stderr, "%s: " _fmt_ "\n", __FUNCTION__, ##__VA_ARGS__); \
56 } while(0)
57 
58 #define DIE(_fmt_, ...) do { \
59  LOG(0, "fatal: " _fmt_, ##__VA_ARGS__); \
60  exit(1); \
61 } while (0)
62 
63 /* options */
64 #define O_BENCH_HASH (1 << 0)
65 #define O_BENCH_LUT (1 << 1)
66 #define O_CHECK_HASH (1 << 2)
67 #define O_MEMCPY (1 << 3)
68 #define O_HASH_MOD (1 << 4)
69 #define O_HASH_MOD16X2 (1 << 5)
70 #define O_HASH_MASK16X2 (1 << 6)
71 #define O_HASH_MASK (1 << 7)
72 #define O_HASH_MASK32X2 (1 << 8)
73 #define O_DEFAULT (0xffffffff & ~O_CHECK_HASH)
74 #define O_HASHES 0xfffffff0
75 
76 /* defaults */
77 static size_t s_options = 0;
78 static size_t s_fp_len = 20;
79 static size_t s_offset = 0;
80 static size_t s_times = 1;
81 static int s_verbosity = 0;
82 static int s_bm_dump = 0;
83 static int s_show_hash = 0;
84 /* From Andrew Trigdell's thesis p72-73:
85  * D1D3: b1=3, b2=7, m1=0xffff m2=(0xffff - 4)
86  * D3D4: b1=7, b2=17, m1=(0xffff - 4), m2=(0xffff - 6)
87  */
88 static size_t s_b1 = 257;
89 static size_t s_b2 = 277;
90 static size_t s_m = 0xffffffff;
91 static size_t s_m1 = 0xffff;
92 static size_t s_m2 = (0xffff - 4);
93 
94 static void
95 dump_bm(const char *label, const char *in, size_t len) {
96  int ret;
97 
98  if (s_verbosity > 1) {
99  printf("----%s encoded:\n", label);
100  fwrite(in, 1, len, stdout);
101  }
102  if (s_bm_dump) {
103  printf("\n----%s dumped:\n", label);
104 
105  if ((ret = bmz_bm_dump(in, len)) != BMZ_E_OK)
106  LOG(1, "error: bad encoded data (ret=%d)", ret);
107 
108  puts("\n----end-dump");
109  }
110 }
111 
112 static void
113 test_bm_mod(const char *in, size_t len, char *out, size_t *len_p,
114  void *work_mem) {
115  bmz_bm_pack_mod(in, len, out, len_p, s_offset, s_fp_len, work_mem, s_b1, s_m);
116  dump_bm("mod", out, *len_p);
117 }
118 
119 static void
120 test_bm_mod16x2(const char *in, size_t len, char *out, size_t *len_p,
121  void *work_mem) {
122  bmz_bm_pack_mod16x2(in, len, out, len_p, s_offset, s_fp_len,
123  work_mem, s_b1, s_b2, s_m1, s_m2);
124  dump_bm("mod16x2", out, *len_p);
125 }
126 
127 static void
128 test_bm_mask16x2(const char *in, size_t len, char *out, size_t *len_p,
129  void *work_mem) {
130  bmz_bm_pack_mask16x2(in, len, out, len_p, s_offset, s_fp_len,
131  work_mem, s_b1, s_b2);
132  dump_bm("mask16x2", out, *len_p);
133 }
134 
135 static void
136 test_bm_mask(const char *in, size_t len, char *out, size_t *len_p,
137  void *work_mem) {
138  bmz_bm_pack_mask(in, len, out, len_p, s_offset, s_fp_len, work_mem, s_b1);
139  dump_bm("mask", out, *len_p);
140 }
141 
142 static void
143 test_bm_mask32x2(const char *in, size_t len, char *out, size_t *len_p,
144  void *work_mem) {
145  bmz_bm_pack_mask32x2(in, len, out, len_p, s_offset, s_fp_len,
146  work_mem, s_b1, s_b2);
147  dump_bm("mask32x2", out, *len_p);
148 }
149 
150 static void
151 test_bm_unpack(const char *in, size_t len, char *out, size_t *len_p) {
152  int ret = bmz_bm_unpack(in, len, out, len_p);
153  LOG(1, "\nbm_unpack returned %d, size: %lu\n", ret, (Lu)*len_p);
154  if (s_verbosity < 2) return;
155  puts("bm decoded:");
156  fwrite(out, 1, *len_p, stdout);
157  puts("\nend-decoded");
158 }
159 
160 static char *
161 read_from_fp(FILE *fp, size_t *len_p) {
162  char *data = NULL;
163  char buf[65536];
164  size_t len = 0, size = 0, ret;
165 
166  while ((ret = fread(buf, 1, sizeof(buf), fp)) > 0) {
167  len += ret;
168 
169  if (len > size) {
170  size = (len + 16) * 3 / 2;
171  data = realloc(data, size);
172  }
173  memcpy(data + len - ret, buf, ret);
174  }
175  *len_p = len;
176  return data;
177 }
178 
179 static void
180 print_hash(const char *label, size_t h) {
181  printf("%16s: %lx\n", label, (Lu)h);
182 }
183 
184 static void
185 show_hash(const char *data, size_t len) {
186 
187  if (s_options & O_HASH_MOD)
188  print_hash("hash-mod", bmz_hash_mod(data, len, s_b1, s_m));
189 
191  print_hash("hash-mod16x2", bmz_hash_mod16x2(data, len, s_b1, s_b2,
192  s_m1, s_m2));
194  print_hash("hash-mask16X2", bmz_hash_mask16x2(data, len, s_b1, s_b2));
195 
196  if (s_options & O_HASH_MASK)
197  print_hash("hash-mask", bmz_hash_mask(data, len, s_b1));
198 
200  print_hash("hash-mask32x2", bmz_hash_mask32x2(data, len, s_b1, s_b2));
201 }
202 
203 static void
204 test_from_string(const char *data, size_t len) {
205  char *buf, *mem;
206  size_t n = s_times;
207  int opt = s_options;
208  size_t out_len, out_len0, len2 = len, work_len;
209 
210  if (s_show_hash) {
211  show_hash(data, len);
212  return;
213  }
214 
215  out_len0 = out_len = bmz_pack_buflen(len);
216  buf = malloc(len + out_len);
217  work_len = bmz_bm_pack_worklen(len, s_fp_len);
218  mem = malloc(work_len);
219  LOG(1, "input length: %lu, out_len %lu, work_len: %lu\n",
220  (Lu)len, (Lu)out_len, (Lu)work_len);
221 
222  /* memcpy/memmove for comparison */
223  if (opt & O_MEMCPY) {
224  BENCH("memcpy", memcpy(buf, data, len), len, n);
225  }
226 
227  if (opt & O_CHECK_HASH) {
228 
229  if (opt & O_HASH_MOD)
231 
232  if (opt & O_HASH_MOD16X2)
234  s_b1, s_b2, s_m1, s_m2) == BMZ_E_OK);
235  if (opt & O_HASH_MASK16X2)
237  == BMZ_E_OK);
238 
239  if (opt & O_HASH_MASK)
241 
242  if (opt & O_HASH_MASK32X2)
244  == BMZ_E_OK);
245  }
246 
247  if (opt & O_BENCH_HASH) {
248 
249  if (opt & O_HASH_MOD)
250  BENCH("hash mod", bmz_bench_hash(data, len, BMZ_HASH_MOD), len, n);
251 
252  if (opt & O_HASH_MOD16X2)
253  BENCH("hash mod16x2", bmz_bench_hash(data, len, BMZ_HASH_MOD16X2),
254  len, n);
255 
256  if (opt & O_HASH_MASK16X2)
257  BENCH("hash mask16x2", bmz_bench_hash(data, len, BMZ_HASH_MASK16X2),
258  len, n);
259 
260  if (opt & O_HASH_MASK)
261  BENCH("hash mask", bmz_bench_hash(data, len, BMZ_HASH_MASK), len, n);
262 
263  if (opt & O_HASH_MASK32X2)
264  BENCH("hash mask32x2", bmz_bench_hash(data, len, BMZ_HASH_MASK32X2),
265  len, n);
266  }
267 
268  if (opt & O_BENCH_LUT) {
269 
270  if (opt & O_HASH_MOD)
271  BENCH("lut mod", bmz_bench_lut_mod(data, len, s_fp_len, mem, s_b1, s_m),
272  len, n);
273 
274  if (opt & O_HASH_MOD16X2)
275  BENCH("lut mod16x2", bmz_bench_lut_mod16x2(data, len, s_fp_len, mem,
276  s_b1, s_b2, s_m1, s_m2), len, n);
277 
278  if (opt & O_HASH_MASK16X2)
279  BENCH("lut mask16x2", bmz_bench_lut_mask16x2(data, len, s_fp_len, mem,
280  s_b1, s_b2), len, n);
281 
282  if (opt & O_HASH_MASK)
283  BENCH("lut mask", bmz_bench_lut_mask(data, len, s_fp_len, mem, s_b1),
284  len, n);
285 
286  if (opt & O_HASH_MASK32X2)
287  BENCH("lut mask32x2", bmz_bench_lut_mask32x2(data, len, s_fp_len, mem,
288  s_b1, s_b2), len, n);
289  }
290 
291  if (opt != O_DEFAULT && (opt & 0xf)) return;
292 
293  if (opt & O_HASH_MOD) {
294  BENCH("bm pack mod", test_bm_mod(data, len, buf, &out_len, mem), len, n);
295  BENCH("bm unpack", test_bm_unpack(buf, out_len, buf + out_len, &len2),
296  len, n);
297  HT_CHECK(len == len2);
298  HT_CHECK(memcmp(data, buf + out_len, len) == 0);
299  }
300 
301  if (opt & O_HASH_MOD16X2) {
302  memset(buf, 0, out_len); out_len = out_len0;
303  BENCH("bm pack mod16x2", test_bm_mod16x2(data, len, buf, &out_len, mem),
304  len, n);
305  BENCH("bm unpack", test_bm_unpack(buf, out_len, buf + out_len, &len2),
306  len, n);
307  HT_CHECK(len == len2);
308  HT_CHECK(memcmp(data, buf + out_len, len) == 0);
309  }
310 
311  if (opt & O_HASH_MASK16X2) {
312  memset(buf, 0, out_len); out_len = out_len0;
313  BENCH("bm pack mask16x2", test_bm_mask16x2(data, len, buf, &out_len, mem),
314  len, n);
315  BENCH("bm unpack", test_bm_unpack(buf, out_len, buf + out_len, &len2),
316  len, n);
317  HT_CHECK(len == len2);
318  HT_CHECK(memcmp(data, buf + out_len, len) == 0);
319  }
320 
321  if (opt & O_HASH_MASK) {
322  memset(buf, 0, out_len); out_len = out_len0;
323  BENCH("bm pack mask", test_bm_mask(data, len, buf, &out_len, mem), len, n);
324  BENCH("bm unpack", test_bm_unpack(buf, out_len, buf + out_len, &len2),
325  len, n);
326  HT_CHECK(len == len2);
327  HT_CHECK(memcmp(data, buf + out_len, len) == 0);
328  }
329 
330  if (opt & O_HASH_MASK32X2) {
331  memset(buf, 0, out_len); out_len = out_len0;
332  BENCH("bm pack mask32x2", test_bm_mask32x2(data, len, buf, &out_len, mem),
333  len, n);
334  BENCH("bm unpack", test_bm_unpack(buf, out_len, buf + out_len, &len2),
335  len, n);
336  HT_CHECK(len == len2);
337  HT_CHECK(memcmp(data, buf + out_len, len) == 0);
338  }
339 }
340 
341 static void
343  size_t len;
344  char *data = read_from_fp(stdin, &len);
345  test_from_string(data, len);
346 }
347 
348 static void
349 test_from_file(const char *fname) {
350  int fd = open(fname, O_RDONLY, 0);
351  char *data = NULL;
352  struct stat st;
353  long len;
354 
355  if (fd == -1) DIE("cannot open '%s'", fname);
356 
357  if (fstat(fd, &st) != 0) DIE("stat failed on '%s'", fname);
358 
359  len = st.st_size;
360 
361  if (!s_no_mmap) {
362 #ifndef HT_NO_MMAP
363  LOG(1, "mmaping %ld bytes in to memory...", len);
364  data = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
365 
366  if ((char *)-1 == data) {
367  LOG(0, "mmap failed on '%s', trying alternative...", fname);
368  errno = 0;
369  data = NULL;
370  }
371 #endif
372  }
373 
374  if (!data) {
375  LOG(1, "reading %ld bytes in to memory...", len);
376 
377  data = malloc(len);
378 
379  if (!data) DIE("error alloc'ing %ld bytes", len);
380 
381  if ((len = read(fd, data, len)) != st.st_size)
382  DIE("error reading %s (expecting %ld bytes, got %ld",
383  fname, (long)st.st_size, len);
384  }
385  else {
386  }
387 
388  test_from_string(data, st.st_size);
389 }
390 
391 static void
393  printf("usage: bmz-test [options] [string...]\n%s%s%s",
394  "--help show this help\n"
395  "--verbose[=level] set verbose level\n"
396  "--file <file> use <file as input\n"
397  "--offset <number> set bm offset\n"
398  "--fp-len <number> set bm fingerprint length\n"
399  "--hash compute hash value only\n"
400  "--b1 <number> hash param b1\n"
401  "--b2 <number> hash param b2\n"
402  "--m <number> hash param m\n",
403  "--m1 <number> hash param m1\n"
404  "--m2 <number> hash param m2\n"
405  "--hash-mod use hash-mod\n"
406  "--hash-mod16x2 use hash-mod16x2\n"
407  "--hash-mask16x2 use hash-mask16x2\n"
408  "--hash-mask use hash-mask\n",
409  "--hash-mask32x2 use hash-mask32x2\n"
410  "--bench-hash bechmarks for builtin hashes\n"
411  "--check-hash verify rolling hashes\n"
412  "--bench-lut benchmarks for lookup table\n"
413  "--times <number> number of repeats for the test\n"
414 );
415  exit(0);
416 }
417 
418 int
419 main(int ac, char *av[]) {
420  char **ia = av + 1, **a_end = av + ac, *ep;
421  const char *fname = NULL;
422 
423  for (; ia < a_end; ++ia) {
424  if (!strcmp("--fp-len", *ia)) s_fp_len = atoi(*++ia);
425  else if (!strcmp("--offset", *ia)) s_offset = atoi(*++ia);
426  else if (!strcmp("--times", *ia)) s_times = atoi(*++ia);
427  else if (!strcmp("--hash", *ia)) s_show_hash = 1;
428  else if (!strcmp("--b1", *ia)) s_b1 = atoi(*++ia);
429  else if (!strcmp("--b2", *ia)) s_b2 = atoi(*++ia);
430  else if (!strcmp("--m", *ia)) s_m = strtol(*++ia, &ep, 0);
431  else if (!strcmp("--m1", *ia)) s_m1 = strtol(*++ia, &ep, 0);
432  else if (!strcmp("--m2", *ia)) s_m2 = strtol(*++ia, &ep, 0);
433  else if (!strcmp("--file", *ia)) fname = *++ia;
434  else if (!strcmp("--no-mmap", *ia)) s_no_mmap = 1;
435  else if (!strcmp("--verbose", *ia)) s_verbosity = 1;
436  else if (!strncmp("--verbose=", *ia, 10)) s_verbosity = atoi(*ia + 10);
437  else if (!strcmp("--bm-dump", *ia)) s_bm_dump = 1;
438  else if (!strcmp("--bench-hash", *ia)) s_options |= O_BENCH_HASH;
439  else if (!strcmp("--check-hash", *ia)) s_options |= O_CHECK_HASH;
440  else if (!strcmp("--bench-lut", *ia)) s_options |= O_BENCH_LUT;
441  else if (!strcmp("--hash-mod", *ia)) s_options |= O_HASH_MOD;
442  else if (!strcmp("--hash-mod16x2", *ia)) s_options |= O_HASH_MOD16X2;
443  else if (!strcmp("--hash-mask16x2", *ia)) s_options |= O_HASH_MASK16X2;
444  else if (!strcmp("--hash-mask", *ia)) s_options |= O_HASH_MASK;
445  else if (!strcmp("--hash-mask32x2", *ia)) s_options |= O_HASH_MASK32X2;
446  else if (!strcmp("--help", *ia)) show_usage();
447  else if (!strcmp("--", *ia)) {
448  ++ia;
449  break;
450  }
451  else if ('-' == **ia) {
452  DIE("unknown option: %s\n", *ia);
453  }
454  else break;
455  }
457 
458  if (!s_options) s_options = O_DEFAULT;
459  else if (!(s_options & O_HASHES)) s_options |= O_HASHES;
460 
461  if (fname)
462  test_from_file(fname);
463  else if (ia >= a_end)
464  test_from_stdin();
465  else for (; ia < a_end; ++ia)
466  test_from_string(*ia, strlen(*ia));
467 
468  return 0;
469 }
470 
471 /* vim: et sw=2
472  */
bmz_bm_unpack(const void *in, size_t in_len, void *out, size_t *out_len_p)
Definition: bmz.c:1338
#define O_BENCH_HASH
Definition: bmz-test.c:64
static void test_bm_mask32x2(const char *in, size_t len, char *out, size_t *len_p, void *work_mem)
Definition: bmz-test.c:143
#define HT_CHECK(e)
Definition: test-helper.h:40
bmz_bm_pack_mod16x2(const void *in, size_t in_len, void *out, size_t *out_len_p, size_t offset, size_t fp_len, void *work_mem, size_t b1, size_t b2, size_t m1, size_t m2)
Definition: bmz.c:1107
static size_t s_no_mmap
Copyright (C) 2007-2015 Hypertable, Inc.
Definition: bmz-test.c:31
bmz_hash_mask32x2(const void *in, size_t in_len, size_t b1, size_t b2)
Definition: bmz.c:535
static size_t s_times
Definition: bmz-test.c:80
static size_t s_b1
Definition: bmz-test.c:88
#define O_DEFAULT
Definition: bmz-test.c:73
static void print_hash(const char *label, size_t h)
Definition: bmz-test.c:180
bmz_hash_mask16x2(const void *in, size_t in_len, size_t b1, size_t b2)
Definition: bmz.c:525
static void test_bm_mask16x2(const char *in, size_t len, char *out, size_t *len_p, void *work_mem)
Definition: bmz-test.c:128
#define O_BENCH_LUT
Definition: bmz-test.c:65
#define BMZ_HASH_MASK
Definition: bmz-internal.h:31
bmz_bm_pack_worklen(size_t in_len, size_t fp_len)
Definition: bmz.c:1172
#define O_HASH_MASK32X2
Definition: bmz-test.c:72
int main(int ac, char *av[])
Definition: bmz-test.c:419
static size_t s_b2
Definition: bmz-test.c:89
bmz_bench_lut_mod(const void *in, size_t in_len, size_t fp_len, void *mem, size_t b, size_t m)
Definition: bmz.c:741
int bmz_set_verbosity(int verbosity)
Set the verbosity of library for testing and debugging.
Definition: bmz.c:246
bmz_hash_mod16x2(const void *in, size_t in_len, size_t b1, size_t b2, size_t m1, size_t m2)
Definition: bmz.c:519
bmz_check_hash_mask32x2(const void *in, size_t in_len, size_t fp_len, size_t b1, size_t b2)
Definition: bmz.c:662
static int s_bm_dump
Definition: bmz-test.c:82
#define BENCH(_label_, _code_, _n_, _times_)
Definition: bmz-test.c:46
static size_t s_offset
Definition: bmz-test.c:79
#define O_HASH_MOD16X2
Definition: bmz-test.c:69
bmz_bench_lut_mask16x2(const void *in, size_t in_len, size_t fp_len, void *mem, size_t b1, size_t b2)
Definition: bmz.c:764
bmz_bench_lut_mask32x2(const void *in, size_t in_len, size_t fp_len, void *mem, size_t b1, size_t b2)
Definition: bmz.c:786
static void test_bm_unpack(const char *in, size_t len, char *out, size_t *len_p)
Definition: bmz-test.c:151
static int s_show_hash
Definition: bmz-test.c:83
static void show_hash(const char *data, size_t len)
Definition: bmz-test.c:185
#define BMZ_HASH_MASK16X2
Definition: bmz-internal.h:30
static void test_bm_mod(const char *in, size_t len, char *out, size_t *len_p, void *work_mem)
Definition: bmz-test.c:113
static size_t s_m1
Definition: bmz-test.c:91
bmz_bm_pack_mod(const void *in, size_t in_len, void *out, size_t *out_len_p, size_t offset, size_t fp_len, void *work_mem, size_t b, size_t m)
Definition: bmz.c:1096
long unsigned Lu
Definition: bmz-test.c:39
#define O_HASH_MOD
Definition: bmz-test.c:68
bmz_bm_pack_mask16x2(const void *in, size_t in_len, void *out, size_t *out_len_p, size_t offset, size_t fp_len, void *work_mem, size_t b1, size_t b2)
Definition: bmz.c:1122
#define O_MEMCPY
Definition: bmz-test.c:67
static size_t s_m
Definition: bmz-test.c:90
bmz_check_hash_mod16x2(const void *in, size_t in_len, size_t fp_len, size_t b1, size_t b2, size_t m1, size_t m2)
Definition: bmz.c:594
bmz_bench_hash(const void *in, size_t in_len, unsigned type)
Definition: bmz.c:686
#define BMZ_HASH_MOD16X2
Definition: bmz-internal.h:29
#define O_HASH_MASK
Definition: bmz-test.c:71
static void test_bm_mask(const char *in, size_t len, char *out, size_t *len_p, void *work_mem)
Definition: bmz-test.c:136
bmz_bench_lut_mask(const void *in, size_t in_len, size_t fp_len, void *mem, size_t b)
Definition: bmz.c:776
#define BMZ_E_OK
Definition: bmz.h:32
size_t bmz_pack_buflen(size_t in_len)
Compute bmz compression output buffer length.
Definition: bmz.c:1164
static void test_bm_mod16x2(const char *in, size_t len, char *out, size_t *len_p, void *work_mem)
Definition: bmz-test.c:120
static size_t s_fp_len
Definition: bmz-test.c:78
static void show_usage()
Definition: bmz-test.c:392
bmz_hash_mask(const void *in, size_t in_len, size_t b)
Definition: bmz.c:530
#define LOG(_lvl_, _fmt_,...)
Definition: bmz-test.c:54
static void test_from_file(const char *fname)
Definition: bmz-test.c:349
static void test_from_stdin()
Definition: bmz-test.c:342
static void dump_bm(const char *label, const char *in, size_t len)
Definition: bmz-test.c:95
#define O_CHECK_HASH
Definition: bmz-test.c:66
bmz_check_hash_mod(const void *in, size_t in_len, size_t fp_len, size_t b, size_t m)
Definition: bmz.c:573
#define O_HASHES
Definition: bmz-test.c:74
static size_t s_m2
Definition: bmz-test.c:92
static size_t s_options
Definition: bmz-test.c:77
bmz_bm_dump(const void *in, size_t in_len)
Definition: bmz.c:1396
static char * read_from_fp(FILE *fp, size_t *len_p)
Definition: bmz-test.c:161
bmz_bm_pack_mask32x2(const void *in, size_t in_len, void *out, size_t *out_len_p, size_t offset, size_t fp_len, void *work_mem, size_t b1, size_t b2)
Definition: bmz.c:1147
#define BMZ_HASH_MASK32X2
Definition: bmz-internal.h:32
#define O_HASH_MASK16X2
Definition: bmz-test.c:70
bmz_bench_lut_mod16x2(const void *in, size_t in_len, size_t fp_len, void *mem, size_t b1, size_t b2, size_t m1, size_t m2)
Definition: bmz.c:751
bmz_check_hash_mask16x2(const void *in, size_t in_len, size_t fp_len, size_t b1, size_t b2)
Definition: bmz.c:618
bmz_hash_mod(const void *in, size_t in_len, size_t b, size_t m)
Definition: bmz.c:514
static int s_verbosity
Definition: bmz-test.c:81
static void test_from_string(const char *data, size_t len)
Definition: bmz-test.c:204
bmz_bm_pack_mask(const void *in, size_t in_len, void *out, size_t *out_len_p, size_t offset, size_t fp_len, void *work_mem, size_t b)
Definition: bmz.c:1136
#define BMZ_HASH_MOD
Definition: bmz-internal.h:28
#define DIE(_fmt_,...)
Definition: bmz-test.c:58
bmz_check_hash_mask(const void *in, size_t in_len, size_t fp_len, size_t b)
Definition: bmz.c:642