github.com/icodeface/tls@v0.0.0-20230910023335-34df9250cd12/internal/bytealg/equal_native.go (about)

     1  // Copyright 2018 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  package bytealg
     6  
     7  import "unsafe"
     8  
     9  // Note: there's no equal_generic.go because every platform must implement at least memequal_varlen in assembly.
    10  
    11  //go:noescape
    12  func Equal(a, b []byte) bool
    13  
    14  // The declarations below generate ABI wrappers for functions
    15  // implemented in assembly in this package but declared in another
    16  // package.
    17  
    18  // The compiler generates calls to runtime.memequal and runtime.memequal_varlen.
    19  // In addition, the runtime calls runtime.memequal explicitly.
    20  // Those functions are implemented in this package.
    21  
    22  //go:linkname abigen_runtime_memequal runtime.memequal
    23  func abigen_runtime_memequal(a, b unsafe.Pointer, size uintptr) bool
    24  
    25  //go:linkname abigen_runtime_memequal_varlen runtime.memequal_varlen
    26  func abigen_runtime_memequal_varlen(a, b unsafe.Pointer) bool