Browse Source

test fnv

master
wes 7 years ago
parent
commit
31c8e93d6d
  1. 4
      Makefile
  2. 11
      bfilter.c

4
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;

11
bfilter.c

@ -5,8 +5,9 @@
#include <ctype.h>
#include <string.h>
#include <assert.h>
#include <fnv.h>
#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;
}

Loading…
Cancel
Save