Merge pull request #4381 from BrzVlad/feature-generational-hash
[mono.git] / mono / metadata / reflection.c
index fbcce02c18cb15aab9c083847680fe611bdc3d6f..43843be4a5a676a9f8f34808588688bbbf81f150 100644 (file)
@@ -165,7 +165,10 @@ reflected_equal (gconstpointer a, gconstpointer b)
 guint
 reflected_hash (gconstpointer a) {
        const ReflectedEntry *ea = (const ReflectedEntry *)a;
-       return mono_aligned_addr_hash (ea->item);
+       /* Combine hashes for item and refclass. Identical to boost's hash_combine */
+       guint seed = mono_aligned_addr_hash (ea->item) + 0x9e3779b9;
+       seed ^= mono_aligned_addr_hash (ea->refclass) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+       return seed;
 }