aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/utils.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2015-03-03 10:46:10 +0100
committerBjörn-Egil Dahlberg <[email protected]>2015-03-12 19:15:30 +0100
commitf316f5f718a9e60ed8dc394a6a0a1cb15147dd2a (patch)
treea0c70bf9fe0ef4c0dc70e7aaecccbd0cf00b9e2a /erts/emulator/beam/utils.c
parent18eabd06e64d21f83f466e99de35302b238ffec7 (diff)
downloadotp-f316f5f718a9e60ed8dc394a6a0a1cb15147dd2a.tar.gz
otp-f316f5f718a9e60ed8dc394a6a0a1cb15147dd2a.tar.bz2
otp-f316f5f718a9e60ed8dc394a6a0a1cb15147dd2a.zip
erts: Fix erlang:hash and erlang:phash for hamt
by calling make_hash2.
Diffstat (limited to 'erts/emulator/beam/utils.c')
-rw-r--r--erts/emulator/beam/utils.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/erts/emulator/beam/utils.c b/erts/emulator/beam/utils.c
index 3b35750fd7..674dddc86f 100644
--- a/erts/emulator/beam/utils.c
+++ b/erts/emulator/beam/utils.c
@@ -1013,21 +1013,9 @@ tail_recur:
break;
}
case MAP_DEF:
+ case HASHMAP_DEF:
{
- map_t *mp = (map_t *)map_val(term);
- int size = map_get_size(mp);
- Eterm *ks = map_get_keys(mp);
- Eterm *vs = map_get_values(mp);
-
- /* Use a prime with size to remedy some of
- * the {} and <<>> hash problems */
- hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + size;
- if (size == 0)
- break;
-
- /* push values first */
- WSTACK_PUSH3(stack, (UWord)vs, (UWord) size, MAKE_HASH_TERM_ARRAY_OP);
- WSTACK_PUSH3(stack, (UWord)ks, (UWord) size, MAKE_HASH_TERM_ARRAY_OP);
+ hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + make_hash2(term);
break;
}
case TUPLE_DEF:
@@ -2164,21 +2152,9 @@ tail_recur:
break;
case MAP_DEF:
+ case HASHMAP_DEF:
{
- map_t *mp = (map_t *)map_val(term);
- int size = map_get_size(mp);
- Eterm *ks = map_get_keys(mp);
- Eterm *vs = map_get_values(mp);
-
- /* Use a prime with size to remedy some of
- * the {} and <<>> hash problems */
- hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + size;
- if (size == 0)
- break;
-
- /* push values first */
- WSTACK_PUSH3(stack, (UWord)vs, (UWord) size, MAKE_HASH_TERM_ARRAY_OP);
- WSTACK_PUSH3(stack, (UWord)ks, (UWord) size, MAKE_HASH_TERM_ARRAY_OP);
+ hash = hash*FUNNY_NUMBER13 + FUNNY_NUMBER14 + make_hash2(term);
break;
}
case TUPLE_DEF: