Debian Codegraph @

internal/bytealg/bytealg_amd64.go

raw
1 // Copyright 2023 Charlie Vieth. All rights reserved.
2 // Use of this source code is governed by the MIT license.
3
4 package bytealg
5
6 import (
7 "unsafe"
8
9 "golang.org/x/sys/cpu"
10 )
11
12 // Offsets into internal/cpu records for use in assembly.
13 const (
14 offsetX86HasAVX2 = unsafe.Offsetof(cpu.X86.HasAVX2)
15 offsetX86HasPOPCNT = unsafe.Offsetof(cpu.X86.HasPOPCNT)
16 )
17
18 // Make golangci-lint think these constants are accessed since it
19 // cannot see accesses in assembly.
20 const _ = offsetX86HasAVX2
21 const _ = offsetX86HasPOPCNT
22
23 //go:noescape
24 func IndexByte(b []byte, c byte) int
25
26 //go:noescape
27 func IndexByteString(s string, c byte) int
28
29 //go:noescape
30 func IndexNonASCII(s string) int
31
32 //go:noescape
33 func IndexByteNonASCII(b []byte) int
34
35 //go:noescape
36 func Count(b []byte, c byte) int
37
38 //go:noescape
39 func CountString(s string, c byte) int