Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -44379,7 +44379,7 @@ static uint32_t map_hash_key(JSContext *ctx, JSValue key)
h = (uintptr_t)JS_VALUE_GET_PTR(key) * 3163;
break;
case JS_TAG_INT:
d = JS_VALUE_GET_INT(key) * 3163;
d = JS_VALUE_GET_INT(key);
goto hash_float64;
case JS_TAG_BIG_INT:
a = JS_GetBigInt(key);
Expand All @@ -44393,7 +44393,7 @@ static uint32_t map_hash_key(JSContext *ctx, JSValue key)
hash_float64:
u.d = d;
h = (u.u32[0] ^ u.u32[1]) * 3163;
break;
return h ^= JS_TAG_FLOAT64;
default:
h = 0;
break;
Expand Down
10 changes: 10 additions & 0 deletions tests/test_builtin.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,16 @@ function test_map()
{
var a, i, n, tab, o, v;
n = 1000;

a = new Map();
for (var i = 0; i < n; i++) {
a.set(i, i);
}
a.set(-2147483648, 1);
assert(a.get(-2147483648), 1);
assert(a.get(-2147483647 - 1), 1);
assert(a.get(-2147483647.5 - 0.5), 1);

a = new Map();
tab = [];
for(i = 0; i < n; i++) {
Expand Down