From 31c8e93d6db52410efefef5c0b538ea36b330a0b Mon Sep 17 00:00:00 2001 From: wes Date: Wed, 5 Jul 2017 13:04:31 -0400 Subject: [PATCH] test fnv --- Makefile | 4 ++-- bfilter.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3385a07..8106a8c 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ default: bfilter.c bfilter.h - $(CC) -g -DTOK_LIB -Wall -Wextra -std=gnu99 -Wpointer-arith -Wmissing-prototypes -lmaa -lm -L. -O3 ./bfilter.c -o test -Wl,-rpath,/home/wes/bfilter; + $(CC) -g -DTOK_LIB -Wall -Wextra -std=gnu99 -Wpointer-arith -Wmissing-prototypes -lm -L. -O3 ./bfilter.c -o test --static `pkg-config --libs --cflags libfnv` -Wl,-rpath,/home/wes/bfilter; unsafe: bfilter.c bfilter.h - $(CC) -DNDEBUG -DTOK_LIB -Wall -std=gnu99 -Wextra -Wpointer-arith -Wmissing-prototypes -lmaa -lm -L. -O3 ./bfilter.c -o bfilter -Wl,-rpath,/home/wes/bfilter; + $(CC) -DNDEBUG -DTOK_LIB -Wall -std=gnu99 -Wextra -Wpointer-arith -Wmissing-prototypes -lm -L. -O3 ./bfilter.c -o bfilter -Wl,-rpath,/home/wes/bfilter; diff --git a/bfilter.c b/bfilter.c index 308e7bc..e3f9db2 100644 --- a/bfilter.c +++ b/bfilter.c @@ -5,8 +5,9 @@ #include #include #include +#include + #include "error.h" -#include "maa.h" #include "bfilter.h" int countbits(int n) { @@ -91,6 +92,14 @@ main (void) { unsetbit(test, 4); unsetbit(test, 2); printbits(test[0]); + + const char *test_string = "foobar"; + uint64_t hval; + char result[17]; + fnv64Init(&hval); + fnv64UpdateBuffer(&hval, test_string, 6); + fnv64ResultHex(result, &hval); + printf("%s\n", result); return EXIT_SUCCESS; }