Simplify code to use get_at method with its get & create semantic
This commit is contained in:
1 parent
cecba9777a
commit
f1e5e9d9db
1 file changed
+3
-3
@@ -22,9 +22,9 @@ void test_int(uint32_t n, uint32_t x0)
|
|||||||
for (i = 0, x = x0; i < n; ++i) {
|
for (i = 0, x = x0; i < n; ++i) {
|
||||||
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_at(h, key);
|
||||||
if (ptr) { (*ptr)++; z+= *ptr; }
|
(*ptr)++;
|
||||||
else { dict_oa_uint_set_at(h, key, 1); z+=1; }
|
z+= *ptr;
|
||||||
}
|
}
|
||||||
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