From c9f05c21daa3d9e27672ef10ddb1aab5f2410d50 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Tue, 28 Feb 2017 21:10:58 +0100 Subject: [PATCH] Fix hash function. --- m-tuple.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/m-tuple.h b/m-tuple.h index 618f4278..8f4033a9 100644 --- a/m-tuple.h +++ b/m-tuple.h @@ -144,13 +144,13 @@ #define TUPLE_DEFINE_HASH(name, ...) \ - static inline unsigned long M_C(name, _hash)(M_C(name,_t) const e1) { \ - unsigned long hash = 0; \ + static inline size_t M_C(name, _hash)(M_C(name,_t) const e1) { \ + M_HASH_DECL(hash); \ M_MAP(TUPLE_DEFINE_HASH_FUNC , __VA_ARGS__) \ return hash; \ } #define TUPLE_DEFINE_HASH_FUNC(a) \ - hash = hash * 31421ul + TUPLE_GET_HASH a ( e1 -> TUPLE_GET_FIELD a); + M_HASH_UP(hash, TUPLE_GET_HASH a ( e1 -> TUPLE_GET_FIELD a) ); #define TUPLE_DEFINE_GET_STR(name, ...) \