Source file src/internal/runtime/maps/memhash_aes.go

     1  // Copyright 2026 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build amd64 || arm64 || 386
     6  
     7  package maps
     8  
     9  import (
    10  	"unsafe"
    11  )
    12  
    13  const memHashAESImplemented = true
    14  
    15  func MemHash(p unsafe.Pointer, h, s uintptr) uintptr {
    16  	if UseAeshash {
    17  		return memHashAES(p, h, s)
    18  	}
    19  	return memHashFallback(p, h, s)
    20  }
    21  
    22  func MemHash32(k uint32, h uintptr) uintptr {
    23  	if UseAeshash {
    24  		return memHash32AES(k, h)
    25  	}
    26  	return memHash32Fallback(k, h)
    27  }
    28  
    29  func MemHash64(k uint64, h uintptr) uintptr {
    30  	if UseAeshash {
    31  		return memHash64AES(k, h)
    32  	}
    33  	return memHash64Fallback(k, h)
    34  }
    35  
    36  func StrHash(s string, h uintptr) uintptr {
    37  	return MemHash(unsafe.Pointer(unsafe.StringData(s)), h, uintptr(len(s)))
    38  }
    39  

View as plain text