aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-04-22 17:22:32 +0100
committerGuilherme Andrade <[email protected]>2017-04-22 17:25:13 +0100
commit21e1d879faaae2278a68200fe1085d7e73791fa0 (patch)
treec711ec5ac1659532787af3c0f44b764426fc88e5 /erts/emulator/beam/erl_nif.c
parentd8756f8665a42effa2f3515369058cff4441abeb (diff)
downloadotp-21e1d879faaae2278a68200fe1085d7e73791fa0.tar.gz
otp-21e1d879faaae2278a68200fe1085d7e73791fa0.tar.bz2
otp-21e1d879faaae2278a68200fe1085d7e73791fa0.zip
erts: Support custom salt in enif_hash
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 3470cf3fd5..bdfb7f3b8e 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -1214,7 +1214,7 @@ int enif_compare(Eterm lhs, Eterm rhs)
return result;
}
-unsigned long enif_hash(ErlNifHash type, Eterm term)
+unsigned long enif_hash(ErlNifHash type, Eterm term, unsigned long salt)
{
#if SIZEOF_LONG < 4
/* This *really* shouldn't happen */
@@ -1222,9 +1222,9 @@ unsigned long enif_hash(ErlNifHash type, Eterm term)
#endif
switch (type) {
case ERL_NIF_INTERNAL_HASH:
- return make_internal_hash(term);
+ return make_internal_hash(term, salt);
case ERL_NIF_PHASH2:
- return make_hash2(term) & ((1 << 27) - 1);
+ return make_hash2(term, salt) & ((1 << 27) - 1);
default:
return 0;
}