File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
compiler/src/dotty/tools/dotc/core/tasty Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -75,18 +75,19 @@ class TastyPickler(val rootCls: ClassSymbol) {
75
75
76
76
/** Returns a non-cryptographic 64-bit hash of the array.
77
77
*
78
- * from https://en.wikipedia.org/wiki/PJW_hash_function#Implementation
78
+ * from https://en.wikipedia.org/wiki/PJW_hash_function#Algorithm
79
79
*/
80
80
private def pjwHash64 (data : Array [Byte ]): Long = {
81
81
var h = 0L
82
82
var i = 0
83
83
while (i < data.length) {
84
84
val d = data(i) & 0xFFL // Interpret byte as unsigned byte
85
- h = (h << 4 ) + d
86
- val high = h & 0xF0000000L
87
- if (high != 0 )
88
- h ^= high >> 24
89
- h &= ~ high
85
+ h = (h << 8 ) + d
86
+ val high = h & 0xFF00000000000000L
87
+ if (high != 0 ) {
88
+ h ^= high >> 48L
89
+ h &= ~ high
90
+ }
90
91
i += 1
91
92
}
92
93
h
You can’t perform that action at this time.
0 commit comments