X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/d3d07a5e860f1cde0e234ec7a1aff7111a2c514f..46b1361b4193f1e19eb18ea4ee95b3d194ce2822:/hashtable.c diff --git a/hashtable.c b/hashtable.c index 8f0a6181..1775a0be 100644 --- a/hashtable.c +++ b/hashtable.c @@ -41,7 +41,7 @@ struct hashtable *hashtable_create(int size, int key64) tbl->size = size; tbl->entries = 0; tbl->node_size = node_size; - tbl->key64 = key64; + tbl->key64 = (short)key64; return tbl; } @@ -104,7 +104,9 @@ void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing) a = b = c = 0xdeadbeef + (8 << 2); #define rot(x,k) (((x)<<(k)) ^ ((x)>>(32-(k)))) +#if SIZEOF_INT64 >= 8 b += (uint32)(key >> 32); +#endif a += (uint32)key; c ^= b; c -= rot(b, 14); a ^= c; a -= rot(c, 11); @@ -140,7 +142,7 @@ void *hashtable_find(struct hashtable *tbl, int64 key, int allocate_if_missing) if (key64) ((struct ht_int64_node*)node)->key = key; else - node->key = key; + node->key = (int32)key; tbl->entries++; return node; }