Hashing on the bytes instead of the words does
a (much) better job of using all the bits, so that
maps of floats have linear performance.
LGTM=khr
R=golang-codereviews, khr
CC=adonovan, golang-codereviews
https://golang.org/cl/
126720044
case f != f:
return c1 * (c0 ^ h ^ uintptr(fastrand2())) // any kind of NaN
default:
- return c1 * (c0 ^ h ^ uintptr(*(*uint32)(unsafe.Pointer(a))))
+ return memhash(unsafe.Pointer(a), 4, h)
}
}
return c1 * (c0 ^ h) // +0, -0
case f != f:
return c1 * (c0 ^ h ^ uintptr(fastrand2())) // any kind of NaN
- case ptrSize == 4:
- x := (*[2]uintptr)(unsafe.Pointer(a))
- return c1 * (c0 ^ h ^ (x[1] * c1) ^ x[0])
default:
- return c1 * (c0 ^ h ^ *(*uintptr)(unsafe.Pointer(a)))
+ return memhash(unsafe.Pointer(a), 8, h)
}
}