summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Machata <pmachata@redhat.com>2014-06-17 17:06:00 +0200
committerChanho Park <chanho61.park@samsung.com>2014-08-22 20:38:26 +0900
commit703e5c6363ae5d07be62c2efa0a17862ce3c1c45 (patch)
tree2a5c4ee42a33e470887316946924c615c63f4673
parentc72ced175870b1dc727171867bfa0854862e8199 (diff)
downloadltrace-703e5c6363ae5d07be62c2efa0a17862ce3c1c45.tar.gz
ltrace-703e5c6363ae5d07be62c2efa0a17862ce3c1c45.tar.bz2
ltrace-703e5c6363ae5d07be62c2efa0a17862ce3c1c45.zip
dict_hash_uint64: do not ignore upper 32 bits of the quantity
-rw-r--r--dict.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/dict.c b/dict.c
index c9a449b..236e90e 100644
--- a/dict.c
+++ b/dict.c
@@ -1,6 +1,6 @@
/*
* This file is part of ltrace.
- * Copyright (C) 2012, 2013 Petr Machata, Red Hat Inc.
+ * Copyright (C) 2012, 2013, 2014 Petr Machata, Red Hat Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -476,11 +476,9 @@ dict_eq_int(const int *key1, const int *key2)
size_t
dict_hash_uint64(const uint64_t *key)
{
- // I use the same hash function as for 32-bit signed integers. This
- // probably will not have great performance for values that don't fit
- // into a 32-bit signed int, but this will do for now
- int key32 = (int)(*key);
- return dict_hash_int(&key32);
+ int const a = (int) *key;
+ int const b = (int) (*key >> 32);
+ return dict_hash_int (&a) ^ dict_hash_int (&b);
}
int