Skip to content

Commit 8aca8a8

Browse files
authored
Merge pull request #4719 from typelevel/issue-4716-2
Backport hash improvements from Scala 2.13.16's MurmurHash3
2 parents 05664ca + e907de8 commit 8aca8a8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/src/main/scala-2.13+/cats/kernel/compat/HashCompat.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private[kernel] class HashCompat {
8989
rangeDiff = hash - prev
9090
rangeState = 2
9191
case 2 =>
92-
if (rangeDiff != hash - prev) rangeState = 3
92+
if (rangeDiff != hash - prev || rangeDiff == 0) rangeState = 3
9393
case _ =>
9494
}
9595
prev = hash
@@ -120,7 +120,7 @@ private[kernel] class HashCompat {
120120
while (it.hasNext) {
121121
h = mix(h, prev)
122122
val hash = A.hash(it.next())
123-
if (rangeDiff != hash - prev) {
123+
if (rangeDiff != hash - prev || rangeDiff == 0) {
124124
h = mix(h, hash)
125125
i += 1
126126
while (it.hasNext) {

0 commit comments

Comments
 (0)