Update to display checksum correctly.

This commit is contained in:
Patrick Pelissier committed 2018-04-30 08:24:31 +02:00
1 parent e41475f672
commit ddc1c7e98f
1 file changed
+2 -17
+2 -17
View File
@@ -1,18 +1,3 @@
/* Makefile:
all:run-test
run-test:test.c ../common.c mlib
$(CC) -std=gnu99 -O2 -Wall -Imlib $< -o $@
mlib:
git clone https://github.com/P-p-H-d/mlib.git
clean:
rm -f run-test* *~
rm -rf mlib
*/
#include "../common.c"
#include "m-dict.h"
@@ -38,8 +23,8 @@ void test_int(uint32_t n, uint32_t x0)
x = hash32(x);
unsigned int key = get_key(n, x);
unsigned int *ptr = dict_oa_uint_get(h, key);
if (ptr) (*ptr)++;
else dict_oa_uint_set_at(h, key, 1);
if (ptr) { (*ptr)++; z+= *ptr; }
else { dict_oa_uint_set_at(h, key, 1); z+=1; }
}
fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z);
dict_oa_uint_clear(h);