diff options
author | Guilherme Andrade <[email protected]> | 2017-04-19 00:43:37 +0100 |
---|---|---|
committer | Guilherme Andrade <[email protected]> | 2017-04-19 01:25:35 +0100 |
commit | 0835f40ae25f97360dc393928796387d3cd6b16e (patch) | |
tree | 22b56cc3a6cb90d79efb394ecd1fab58e1182f8c /erts/doc/src/erl_nif.xml | |
parent | 6124bfc9b61227a5e82f1d7273d0895e909aac6e (diff) | |
download | otp-0835f40ae25f97360dc393928796387d3cd6b16e.tar.gz otp-0835f40ae25f97360dc393928796387d3cd6b16e.tar.bz2 otp-0835f40ae25f97360dc393928796387d3cd6b16e.zip |
erts: Add enif_phash2 and enif_phash2_ranged
These allow one to hash VM terms from NIF code.
Diffstat (limited to 'erts/doc/src/erl_nif.xml')
-rw-r--r-- | erts/doc/src/erl_nif.xml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index 6bb1109415..34dae418ef 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -2370,6 +2370,36 @@ enif_map_iterator_destroy(env, &iter);</code> </func> <func> + <name> + <ret>unsigned long</ret> + <nametext>enif_phash2(ERL_NIF_TERM term)</nametext> + </name> + <fsummary>Portable hash function.</fsummary> + <desc> + <p>Portable hash function that gives the same hash for the same Erlang term + regardless of machine architecture and ERTS version. Corresponds to + <seealso marker="erlang#phash2-1"><c>erlang:phash2/1</c></seealso>.</p> + <p>Returns an unsigned integer within <c>0..2^27-1</c>.</p> + </desc> + </func> + + <func> + <name> + <ret>unsigned long</ret> + <nametext>enif_phash2_ranged(ERL_NIF_TERM term, unsigned long range)</nametext> + </name> + <fsummary>Portable hash function.</fsummary> + <desc> + <p>Similar to <seealso marker="#enif_phash2"><c>enif_phash2</c></seealso> + but hash range can be specified. Corresponds to + <seealso marker="erlang#phash2-2"><c>erlang:phash2/2</c></seealso>.</p> + <p>Returns an unsigned integer within <c>0..range-1</c> + if <c>0 < range < 2^32</c>, and within <c>0..2^32-1</c> otherwise. + </p> + </desc> + </func> + + <func> <name><ret>int</ret><nametext>enif_port_command(ErlNifEnv* env, const ErlNifPort* to_port, ErlNifEnv *msg_env, ERL_NIF_TERM msg)</nametext> </name> |