Update to display checksum correctly.
This commit is contained in:
1 parent
e41475f672
commit
ddc1c7e98f
1 file changed
+2
-17
+2
-17
@@ -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 "../common.c"
|
||||||
#include "m-dict.h"
|
#include "m-dict.h"
|
||||||
|
|
||||||
@@ -38,8 +23,8 @@ void test_int(uint32_t n, uint32_t x0)
|
|||||||
x = hash32(x);
|
x = hash32(x);
|
||||||
unsigned int key = get_key(n, x);
|
unsigned int key = get_key(n, x);
|
||||||
unsigned int *ptr = dict_oa_uint_get(h, key);
|
unsigned int *ptr = dict_oa_uint_get(h, key);
|
||||||
if (ptr) (*ptr)++;
|
if (ptr) { (*ptr)++; z+= *ptr; }
|
||||||
else dict_oa_uint_set_at(h, key, 1);
|
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);
|
fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z);
|
||||||
dict_oa_uint_clear(h);
|
dict_oa_uint_clear(h);
|
||||||
|
|||||||
Reference in new issue
Block a user