Skip to content

Commit

Permalink
Switch to FxHasher for 32bit values
Browse files Browse the repository at this point in the history
  • Loading branch information
Zentrik committed Dec 18, 2023
1 parent 417c3a0 commit 80ee622
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
8 changes: 1 addition & 7 deletions src/julia_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,7 @@ extern JL_DLLEXPORT _Atomic(uint64_t) jl_cumulative_recompile_time;

STATIC_INLINE uint32_t jl_int32hash_fast(uint32_t a)
{
// a = (a+0x7ed55d16) + (a<<12);
// a = (a^0xc761c23c) ^ (a>>19);
// a = (a+0x165667b1) + (a<<5);
// a = (a+0xd3a2646c) ^ (a<<9);
// a = (a+0xfd7046c5) + (a<<3);
// a = (a^0xb55a4f09) ^ (a>>16);
return a; // identity hashing seems to work well enough here
return a * 0x9e3779b9;
}


Expand Down
8 changes: 1 addition & 7 deletions src/support/hashing.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ extern "C" {

uint32_t int32hash(uint32_t a)
{
a = (a+0x7ed55d16) + (a<<12);
a = (a^0xc761c23c) ^ (a>>19);
a = (a+0x165667b1) + (a<<5);
a = (a+0xd3a2646c) ^ (a<<9);
a = (a+0xfd7046c5) + (a<<3);
a = (a^0xb55a4f09) ^ (a>>16);
return a;
return a * 0x9e3779b9;
}

// FxHasher
Expand Down

0 comments on commit 80ee622

Please sign in to comment.