in bench/hash.go [32:60]
func strhash(s string, h uintptr) uintptr
//go:noescape
func inthash(i int, h uintptr) uintptr
// PtrSize is the size of a pointer in bytes - unsafe.Sizeof(uintptr(0)) but as an ideal constant.
// It is also the size of the machine's native word size (4 on 32-bit systems, 8 on 64-bit).
const PtrSize = 4 << (^uintptr(0) >> 63)
const hashRandomBytes = PtrSize / 4 * 64
const (
// FNV-1a
offset32 = uint32(2166136261)
prime32 = uint32(16777619)
// Init32 is what 32 bits hash values should be initialized with.
Init32 = offset32
)
// used in asm_{386,amd64,arm64}.s to seed the hash function
var aeskeysched [hashRandomBytes]byte
func init() {
for i := 0; i < hashRandomBytes; i++ {
aeskeysched[i] = byte(i + 1)
}
aeskeysched[hashRandomBytes-1] = 0xFF
}