]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix memhash64 on big endian systems
authorMichael Munday <mike.munday@ibm.com>
Tue, 29 Aug 2017 04:10:17 +0000 (05:10 +0100)
committerMichael Munday <mike.munday@ibm.com>
Tue, 29 Aug 2017 04:39:41 +0000 (04:39 +0000)
Fixes #21677.

Change-Id: I869dee5f43df5d87d86922681726297e3024c562
Reviewed-on: https://go-review.googlesource.com/59810
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/runtime/hash64.go

index 22085d3df074c202c280501eead203c02f8e2a5a..3cf3f4629b63742efdafeb975a47d48998c7b10b 100644 (file)
@@ -95,7 +95,7 @@ func memhash32(p unsafe.Pointer, seed uintptr) uintptr {
 
 func memhash64(p unsafe.Pointer, seed uintptr) uintptr {
        h := uint64(seed + 8*hashkey[0])
-       h ^= readUnaligned64(p)
+       h ^= uint64(readUnaligned32(p)) | uint64(readUnaligned32(add(p, 4)))<<32
        h = rotl_31(h*m1) * m2
        h ^= h >> 29
        h *= m3