From 499a538e83b504eae266c45d7e3555df86996b1e Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Tue, 24 Jun 2014 13:29:28 +0200 Subject: [PATCH 1/1] [mc] Avoid loosing meaningful bits ot pair.p2 when hashing pointer pair --- src/mc/mc_compare.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)); } }; } -- 2.20.1