Debian Codegraph @

simd/memchr_digit_amd64.go

raw symbols SCIP
1 // Adapted from the coregex project, https://github.com/coregx/coregex
2 // (package simd), Copyright (c) 2025 Andrey Kolkov and contributors,
3 // MIT License. See the LICENSE file in this directory for the full text.
4
5 //go:build amd64
6
7 package simd
8
9 // memchrDigitAVX2 is implemented in memchr_digit_amd64.s. It finds bytes in
10 // ['0','9'] via two signed VPCMPGTB range comparisons, four 32-byte vectors
11 // per iteration.
12 //
13 //go:noescape
14 func memchrDigitAVX2(haystack []byte) int
15
16 // memchrDigitImpl dispatches to the AVX2 kernel for inputs large enough to
17 // amortize the vector setup. The caller guarantees a non-empty haystack.
18 func memchrDigitImpl(haystack []byte) int {
19 if hasAVX2 && len(haystack) >= MinLen {
20 return memchrDigitAVX2(haystack)
21 }
22 return memchrDigitGeneric(haystack)
23 }