aboutsummaryrefslogtreecommitdiffstats
path: root/erts/doc/src
diff options
context:
space:
mode:
authorGuilherme Andrade <[email protected]>2017-04-20 22:44:04 +0100
committerGuilherme Andrade <[email protected]>2017-04-20 22:54:17 +0100
commitd8756f8665a42effa2f3515369058cff4441abeb (patch)
treebce1d8701307f9389c098c3316a6f7a8dee50127 /erts/doc/src
parent5ad95cca3f3c6802cd71fdd35dd397c3a37dc239 (diff)
downloadotp-d8756f8665a42effa2f3515369058cff4441abeb.tar.gz
otp-d8756f8665a42effa2f3515369058cff4441abeb.tar.bz2
otp-d8756f8665a42effa2f3515369058cff4441abeb.zip
erts: Refactor enif_phash2 into enif_hash
A more generic hashing function which can also hash terms based on `make_internal_hash'.
Diffstat (limited to 'erts/doc/src')
-rw-r--r--erts/doc/src/erl_nif.xml49
1 files changed, 35 insertions, 14 deletions
diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml
index 35c42ac517..53b6fdeaa1 100644
--- a/erts/doc/src/erl_nif.xml
+++ b/erts/doc/src/erl_nif.xml
@@ -813,6 +813,28 @@ typedef enum {
</item>
</taglist>
</item>
+ <tag><marker id="ErlNifHash"/><c>ErlNifHash</c></tag>
+ <item>
+ <p>An enumeration of the supported hash types that can be generated
+ using <seealso marker="#enif_hash"><c>enif_hash</c></seealso>.
+ </p>
+ <taglist>
+ <tag><c>ERL_NIF_INTERNAL_HASH</c></tag>
+ <item>
+ <p>Non-portable hash function that gives different hashes for the same Erlang
+ term depending on machine architecture and ERTS version.</p>
+ <p>Generated hash values within <c>0..2^32-1</c>.</p>
+ </item>
+ <tag><c>ERL_NIF_PHASH2</c></tag>
+ <item>
+ <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>Slower than <c>ERL_NIF_INTERNAL_HASH.</c></p>
+ <p>Generated hash values within <c>0..2^27-1</c>.</p>
+ </item>
+ </taglist>
+ </item>
</taglist>
</section>
@@ -1387,6 +1409,19 @@ typedef enum {
</func>
<func>
+ <name>
+ <ret>unsigned long</ret>
+ <nametext>enif_hash(ErlNifHash type, ERL_NIF_TERM term)</nametext>
+ </name>
+ <fsummary>Hash terms.</fsummary>
+ <desc>
+ <p>Hash terms according to the specified
+ <seealso marker="#ErlNifHash"><c>ErlNifHash</c></seealso> type.</p>
+ <p>Range of returned value depends on the hash type.</p>
+ </desc>
+ </func>
+
+ <func>
<name><ret>int</ret><nametext>enif_inspect_binary(ErlNifEnv* env,
ERL_NIF_TERM bin_term, ErlNifBinary* bin)</nametext></name>
<fsummary>Inspect the content of a binary.</fsummary>
@@ -2370,20 +2405,6 @@ 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>int</ret><nametext>enif_port_command(ErlNifEnv* env, const
ErlNifPort* to_port, ErlNifEnv *msg_env, ERL_NIF_TERM msg)</nametext>
</name>