aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-26 12:13:19 +0200
committerSverker Eriksson <[email protected]>2016-05-26 12:13:19 +0200
commit50447f0bfa84046961cdc7693f7c374f5b81d461 (patch)
tree5cf4894434e0350dbf235378b93fa43fd0cffb10 /erts/emulator/beam
parent83b3007c6776be6e35ad8909af1a9d0707baa4d9 (diff)
downloadotp-50447f0bfa84046961cdc7693f7c374f5b81d461.tar.gz
otp-50447f0bfa84046961cdc7693f7c374f5b81d461.tar.bz2
otp-50447f0bfa84046961cdc7693f7c374f5b81d461.zip
erts: Improve some bad hash functions
Multiplying two atoms will always yield the same low 6 bits. The most important tabke 'export' was saved by the prime number table size which seemed to yield a decent uniform distribution anyway.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/export.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c
index 02c24557c1..cfe7c06823 100644
--- a/erts/emulator/beam/export.c
+++ b/erts/emulator/beam/export.c
@@ -31,7 +31,7 @@
#define EXPORT_INITIAL_SIZE 4000
#define EXPORT_LIMIT (512*1024)
-#define EXPORT_HASH(m,f,a) ((m)*(f)+(a))
+#define EXPORT_HASH(m,f,a) ((atom_val(m) * atom_val(f)) ^ (a))
#ifdef DEBUG
# define IF_DEBUG(x) x