Skip to content

Commit

Permalink
Use FxHasher as intended
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentrik committed Dec 11, 2023
1 parent d7ff964 commit 62d5814
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ static unsigned typekey_hash(jl_typename_t *tn, jl_value_t **key, size_t n, int
if (tn == jl_type_typename && key[0] == jl_bottom_type)
return jl_typeofbottom_type->hash;
size_t j;
unsigned hash = 3;
unsigned hash = 0;
int failed = nofail;
for (j = 0; j < n; j++) {
jl_value_t *p = key[j];
Expand All @@ -1608,16 +1608,16 @@ static unsigned typekey_hash(jl_typename_t *tn, jl_value_t **key, size_t n, int
if (vm->N && jl_is_long(vm->N))
repeats = jl_unbox_long(vm->N);
else
hash = bitmix(0x064eeaab, hash); // 0x064eeaab is just a randomly chosen constant
hash = bitmix(hash, 0x064eeaab); // 0x064eeaab is just a randomly chosen constant
p = vm->T ? vm->T : (jl_value_t*)jl_any_type;
}
unsigned hashp = type_hash(p, &failed);
if (failed && !nofail)
return 0;
while (repeats--)
hash = bitmix(hashp, hash);
hash = bitmix(hash, hashp);
}
hash = bitmix(~tn->hash, hash);
hash = bitmix(hash, ~tn->hash);
return hash ? hash : 1;
}

Expand All @@ -1636,9 +1636,9 @@ static unsigned typekeyvalue_hash(jl_typename_t *tn, jl_value_t *key1, jl_value_
else {
hj = ((jl_datatype_t*)jl_typeof(kj))->hash;
}
hash = bitmix(hj, hash);
hash = bitmix(hash, hj);
}
hash = bitmix(~tn->hash, hash);
hash = bitmix(hash, ~tn->hash);
return hash ? hash : 1;
}

Expand Down

0 comments on commit 62d5814

Please sign in to comment.