Update to use FNVHASH for internal hash calculation for object.

(Not for memory layout).
This commit is contained in:
Patrick Pelissier committed 2017-08-17 20:45:46 +02:00
1 parent 9f24ce6d22
commit d97741b6a9
1 file changed
+3 -5
+3 -5
View File
@@ -659,17 +659,15 @@
#elif defined(M_USE_BPHASH)
#define M_HASH_INIT 0UL
#define M_HASH_CALC(h1,h2) (((h1) << 7) ^ (h2))
#elif defined(M_USE_FNVHASH)
#else
//FNVHASH
#define M_HASH_INIT 0UL
#define M_HASH_CALC(h1,h2) (((h1) * 0x811C9DC5UL) ^ (h2))
#else
#define M_HASH_INIT 0UL
#define M_HASH_CALC(h1,h2) (((h1) * 31421) + (h2) + 6927)
#endif
#define M_HASH_DECL(hash) size_t hash = M_HASH_INIT ^ M_HASH_SEED
#define M_HASH_UP(hash,h) do { hash = M_HASH_CALC(hash, (h)); } while (0)
#define M_HASH_FINAL(hash) (hash)
#define M_HASH_FINAL(hash) ( (hash) >> (sizeof(size_t)*CHAR_BIT/2) | (hash) )
/* Safe, efficient, and portable Rotate:
It should be recognized by any compiler and generate a single roll instruction */