aboutsummaryrefslogtreecommitdiffstats
path: root/erts/doc/src/erl_nif.xml
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-04-19 00:43:37 +0100
committerGuilherme Andrade <[email protected]>2017-04-19 01:25:35 +0100
commit0835f40ae25f97360dc393928796387d3cd6b16e (patch)
tree22b56cc3a6cb90d79efb394ecd1fab58e1182f8c /erts/doc/src/erl_nif.xml
parent6124bfc9b61227a5e82f1d7273d0895e909aac6e (diff)
downloadotp-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.xml30
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, &amp;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 &lt; range &lt; 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>