Skip to content

Commit

Permalink
Inline function call
Browse files Browse the repository at this point in the history
  • Loading branch information
wendigo committed Jun 30, 2024
1 parent 6b7dc8b commit 0fdbca9
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/main/java/io/airlift/slice/XxHash64.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ private long computeBody()
{
long hash = rotateLeft(v1, 1) + rotateLeft(v2, 7) + rotateLeft(v3, 12) + rotateLeft(v4, 18);

hash = update(hash, v1);
hash = update(hash, v2);
hash = update(hash, v3);
hash = update(hash, v4);
hash = (hash ^ mix(0, v1)) * PRIME64_1 + PRIME64_4;
hash = (hash ^ mix(0, v2)) * PRIME64_1 + PRIME64_4;
hash = (hash ^ mix(0, v3)) * PRIME64_1 + PRIME64_4;
hash = (hash ^ mix(0, v4)) * PRIME64_1 + PRIME64_4;

return hash;
}
Expand Down Expand Up @@ -274,10 +274,10 @@ private static long updateBody(long seed, MemorySegment base, long offset, int l

long hash = rotateLeft(v1, 1) + rotateLeft(v2, 7) + rotateLeft(v3, 12) + rotateLeft(v4, 18);

hash = update(hash, v1);
hash = update(hash, v2);
hash = update(hash, v3);
hash = update(hash, v4);
hash = (hash ^ mix(0, v1)) * PRIME64_1 + PRIME64_4;
hash = (hash ^ mix(0, v2)) * PRIME64_1 + PRIME64_4;
hash = (hash ^ mix(0, v3)) * PRIME64_1 + PRIME64_4;
hash = (hash ^ mix(0, v4)) * PRIME64_1 + PRIME64_4;

return hash;
}
Expand All @@ -287,12 +287,6 @@ private static long mix(long current, long value)
return rotateLeft(current + value * PRIME64_2, 31) * PRIME64_1;
}

private static long update(long hash, long value)
{
long temp = hash ^ mix(0, value);
return temp * PRIME64_1 + PRIME64_4;
}

private static long updateTail(long hash, long value)
{
long temp = hash ^ mix(0, value);
Expand Down

0 comments on commit 0fdbca9

Please sign in to comment.