mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 14:04:52 +02:00
Add not_index_byte and not_index_byte2 functions to simdstring package
Fixes #9646
This commit is contained in:
committed by
Kovid Goyal
parent
d8af7e2c88
commit
f4bf9cf1c9
@@ -57,3 +57,39 @@ func index_c0_string_scalar(data string) int {
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func not_index_byte_scalar(data []byte, b byte) int {
|
||||
for i, ch := range data {
|
||||
if ch != b {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func not_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 not_index_byte2_scalar(data []byte, a, b byte) int {
|
||||
for i, ch := range data {
|
||||
if ch != a && ch != b {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func not_index_byte2_string_scalar(data string, a, b byte) int {
|
||||
for i := 0; i < len(data); i++ {
|
||||
if data[i] != a && data[i] != b {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user