From: Gabriel Corona Date: Tue, 24 Jun 2014 11:29:28 +0000 (+0200) Subject: [mc] Avoid loosing meaningful bits ot pair.p2 when hashing pointer pair X-Git-Tag: v3_12~956^2~1^2~4 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/499a538e83b504eae266c45d7e3555df86996b1e [mc] Avoid loosing meaningful bits ot pair.p2 when hashing pointer pair --- diff --git a/src/mc/mc_compare.cpp b/src/mc/mc_compare.cpp index 5a7c634617..6eaa3bf79f 100644 --- a/src/mc/mc_compare.cpp +++ b/src/mc/mc_compare.cpp @@ -29,9 +29,10 @@ typedef struct s_pointers_pair { namespace boost { template<> struct hash { - typedef uint64_t result_type; + typedef uintptr_t result_type; result_type operator()(s_pointers_pair const& x) const { - return (result_type) x.p1 ^ (result_type) x.p2 << 8; + return (result_type) x.p1 ^ + ((result_type) x.p2 << 8 | (result_type) x.p2 >> (8*sizeof(uintptr_t) - 8)); } }; }