X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=tests%2Ftest_urcu_hash.c;h=043a33a9353105eac57e2363693bdfb41c49f12c;hp=509767c02e795411ff94cbc5582f589e2d792e31;hb=747d725c1dd45d5072e0e411642c4d5c6403b4be;hpb=6f554439fc4efcaa55dbf4fcb8a9d2dac5a4a91e diff --git a/tests/test_urcu_hash.c b/tests/test_urcu_hash.c index 509767c..043a33a 100644 --- a/tests/test_urcu_hash.c +++ b/tests/test_urcu_hash.c @@ -384,7 +384,7 @@ void hashword2( #if (CAA_BITS_PER_LONG == 32) static -unsigned long test_hash(void *_key, size_t length, unsigned long seed) +unsigned long test_hash(const void *_key, size_t length, unsigned long seed) { unsigned int key = (unsigned int) _key; @@ -393,7 +393,7 @@ unsigned long test_hash(void *_key, size_t length, unsigned long seed) } #else static -unsigned long test_hash(void *_key, size_t length, unsigned long seed) +unsigned long test_hash(const void *_key, size_t length, unsigned long seed) { union { uint64_t v64; @@ -413,8 +413,8 @@ unsigned long test_hash(void *_key, size_t length, unsigned long seed) #endif static -unsigned long test_compare(void *key1, size_t key1_len, - void *key2, size_t key2_len) +unsigned long test_compare(const void *key1, size_t key1_len, + const void *key2, size_t key2_len) { if (caa_unlikely(key1_len != key2_len)) return -1; @@ -426,7 +426,7 @@ unsigned long test_compare(void *key1, size_t key1_len, } static -int test_match(struct cds_lfht_node *node, void *key) +int test_match(struct cds_lfht_node *node, const void *key) { struct lfht_test_node *test_node = to_test_node(node); @@ -896,7 +896,7 @@ int main(int argc, char **argv) return -1; } - if (min_hash_alloc_size && min_hash_alloc_size * (min_hash_alloc_size - 1)) { + if (min_hash_alloc_size && min_hash_alloc_size & (min_hash_alloc_size - 1)) { printf("Error: Min hash alloc size %lu is not a power of 2.\n", min_hash_alloc_size); return -1; @@ -967,7 +967,7 @@ int main(int argc, char **argv) * thread from the point of view of resize. */ rcu_register_thread(); - test_ht = cds_lfht_new(init_hash_size, min_hash_alloc_size, + test_ht = cds_lfht_new(init_hash_size, min_hash_alloc_size, (1UL << 18), (opt_auto_resize ? CDS_LFHT_AUTO_RESIZE : 0) | CDS_LFHT_ACCOUNTING, NULL); ret = populate_hash();