| Server IP : 84.32.84.93 / Your IP : 216.73.217.88 Web Server : LiteSpeed System : Linux in-mum-web1677.main-hosting.eu 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : u635632881 ( 635632881) PHP Version : 8.2.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/golang/1.22.0/src/hash/maphash/ |
Upload File : |
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//go:build !purego
package maphash
import (
"unsafe"
)
//go:linkname runtime_rand runtime.rand
func runtime_rand() uint64
//go:linkname runtime_memhash runtime.memhash
//go:noescape
func runtime_memhash(p unsafe.Pointer, seed, s uintptr) uintptr
func rthash(buf []byte, seed uint64) uint64 {
if len(buf) == 0 {
return seed
}
len := len(buf)
// The runtime hasher only works on uintptr. For 64-bit
// architectures, we use the hasher directly. Otherwise,
// we use two parallel hashers on the lower and upper 32 bits.
if unsafe.Sizeof(uintptr(0)) == 8 {
return uint64(runtime_memhash(unsafe.Pointer(&buf[0]), uintptr(seed), uintptr(len)))
}
lo := runtime_memhash(unsafe.Pointer(&buf[0]), uintptr(seed), uintptr(len))
hi := runtime_memhash(unsafe.Pointer(&buf[0]), uintptr(seed>>32), uintptr(len))
return uint64(hi)<<32 | uint64(lo)
}
func rthashString(s string, state uint64) uint64 {
buf := unsafe.Slice(unsafe.StringData(s), len(s))
return rthash(buf, state)
}
func randUint64() uint64 {
return runtime_rand()
}