mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 05:54:59 +02:00
Add an IndexByte implementation useful for benchmarking against stdlib SIMD implementation
This commit is contained in:
@@ -2,6 +2,24 @@
|
||||
|
||||
package simdstring
|
||||
|
||||
func index_byte_scalar(data []byte, b byte) int {
|
||||
for i, ch := range data {
|
||||
if ch == b {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func index_byte_string_scalar(data string, b byte) int {
|
||||
for i := 0; i < len(data); i++ {
|
||||
if data[i] == b {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func index_byte2_scalar(data []byte, a, b byte) int {
|
||||
for i, ch := range data {
|
||||
switch ch {
|
||||
|
||||
Reference in New Issue
Block a user