diff options
author | Sverker Eriksson <[email protected]> | 2016-05-26 12:13:19 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2016-05-26 12:13:19 +0200 |
commit | 50447f0bfa84046961cdc7693f7c374f5b81d461 (patch) | |
tree | 5cf4894434e0350dbf235378b93fa43fd0cffb10 /erts/emulator/hipe/hipe_bif0.c | |
parent | 83b3007c6776be6e35ad8909af1a9d0707baa4d9 (diff) | |
download | otp-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/hipe/hipe_bif0.c')
-rw-r--r-- | erts/emulator/hipe/hipe_bif0.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/hipe/hipe_bif0.c b/erts/emulator/hipe/hipe_bif0.c index 4063cbf306..307d2424ce 100644 --- a/erts/emulator/hipe/hipe_bif0.c +++ b/erts/emulator/hipe/hipe_bif0.c @@ -693,7 +693,7 @@ static struct nbif nbifs[BIF_SIZE] = { #undef BIF_LIST }; -#define NBIF_HASH(m,f,a) ((m)*(f)+(a)) +#define NBIF_HASH(m,f,a) (atom_val(m) ^ atom_val(f) ^ (a)) static Hash nbif_table; static HashValue nbif_hash(struct nbif *x) @@ -1059,7 +1059,7 @@ static inline void hipe_mfa_info_table_rwunlock(void) erts_smp_rwmtx_rwunlock(&hipe_mfa_info_table.lock); } -#define HIPE_MFA_HASH(M,F,A) ((M) * (F) + (A)) +#define HIPE_MFA_HASH(M,F,A) (atom_val(M) ^ atom_val(F) ^ (A)) static struct hipe_mfa_info **hipe_mfa_info_table_alloc_bucket(unsigned int size) { |