Skip to content

Commit

Permalink
Backport hash improvements from Scala 2.13.16's MurmurHash3
Browse files Browse the repository at this point in the history
  • Loading branch information
rossabaker committed Feb 21, 2025
1 parent 87b2a4a commit e907de8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private[kernel] class HashCompat {
rangeDiff = hash - prev
rangeState = 2
case 2 =>
if (rangeDiff != hash - prev) rangeState = 3
if (rangeDiff != hash - prev || rangeDiff == 0) rangeState = 3
case _ =>
}
prev = hash
Expand Down Expand Up @@ -120,7 +120,7 @@ private[kernel] class HashCompat {
while (it.hasNext) {
h = mix(h, prev)
val hash = A.hash(it.next())
if (rangeDiff != hash - prev) {
if (rangeDiff != hash - prev || rangeDiff == 0) {
h = mix(h, hash)
i += 1
while (it.hasNext) {
Expand Down

0 comments on commit e907de8

Please sign in to comment.