diff options
author | Guilherme Andrade <[email protected]> | 2017-04-22 20:00:28 +0100 |
---|---|---|
committer | Guilherme Andrade <[email protected]> | 2017-04-22 20:00:28 +0100 |
commit | da9abd24a93ae8fe174cdd38fc9699bbc45fdf56 (patch) | |
tree | 7ad0766a1d5a235ebbbf92af770241e7dd035885 /erts/emulator/beam/erl_nif.c | |
parent | d810cd2b1ce642703d4986ba26ba50fd7949fcab (diff) | |
download | otp-da9abd24a93ae8fe174cdd38fc9699bbc45fdf56.tar.gz otp-da9abd24a93ae8fe174cdd38fc9699bbc45fdf56.tar.bz2 otp-da9abd24a93ae8fe174cdd38fc9699bbc45fdf56.zip |
erts: Allow for easier future enif_hash expansion
Allow for expanding support to 64-bit hashes without breaking the
interface.
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index bdfb7f3b8e..3ff6c8d3ed 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1214,17 +1214,13 @@ int enif_compare(Eterm lhs, Eterm rhs) return result; } -unsigned long enif_hash(ErlNifHash type, Eterm term, unsigned long salt) +ErlNifUInt64 enif_hash(ErlNifHash type, Eterm term, ErlNifUInt64 salt) { -#if SIZEOF_LONG < 4 -/* This *really* shouldn't happen */ -# error Incompatible long word size -#endif switch (type) { case ERL_NIF_INTERNAL_HASH: - return make_internal_hash(term, salt); + return make_internal_hash(term, (Uint32) salt); case ERL_NIF_PHASH2: - return make_hash2(term, salt) & ((1 << 27) - 1); + return make_hash2(term, (Uint32) salt) & ((1 << 27) - 1); default: return 0; } |