| 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 simdscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/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 memchrDigitAVX2scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/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 memchrDigitImplscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchrDigitImpl().(haystack []byte) int { |
| 19 | if hasAVX2scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/hasAVX2. && len(haystack) >= MinLenscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/MinLen. { |
| 20 | return memchrDigitAVX2scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchrDigitAVX2().(haystack) |
| 21 | } |
| 22 | return memchrDigitGenericscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2/simd`/memchrDigitGeneric().(haystack) |
| 23 | } |