Skip to content

Commit 80ee622

Browse files
committed
Switch to FxHasher for 32bit values
1 parent 417c3a0 commit 80ee622

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/julia_internal.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,7 @@ extern JL_DLLEXPORT _Atomic(uint64_t) jl_cumulative_recompile_time;
278278

279279
STATIC_INLINE uint32_t jl_int32hash_fast(uint32_t a)
280280
{
281-
// a = (a+0x7ed55d16) + (a<<12);
282-
// a = (a^0xc761c23c) ^ (a>>19);
283-
// a = (a+0x165667b1) + (a<<5);
284-
// a = (a+0xd3a2646c) ^ (a<<9);
285-
// a = (a+0xfd7046c5) + (a<<3);
286-
// a = (a^0xb55a4f09) ^ (a>>16);
287-
return a; // identity hashing seems to work well enough here
281+
return a * 0x9e3779b9;
288282
}
289283

290284

src/support/hashing.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,7 @@ extern "C" {
1616

1717
uint32_t int32hash(uint32_t a)
1818
{
19-
a = (a+0x7ed55d16) + (a<<12);
20-
a = (a^0xc761c23c) ^ (a>>19);
21-
a = (a+0x165667b1) + (a<<5);
22-
a = (a+0xd3a2646c) ^ (a<<9);
23-
a = (a+0xfd7046c5) + (a<<3);
24-
a = (a^0xb55a4f09) ^ (a>>16);
25-
return a;
19+
return a * 0x9e3779b9;
2620
}
2721

2822
// FxHasher

0 commit comments

Comments
 (0)