mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-04 22:03:48 +02:00
run modernize
This commit is contained in:
@@ -33,7 +33,7 @@ func BenchmarkIndexByte(b *testing.B) {
|
||||
f = bytes.IndexByte
|
||||
}
|
||||
b.Run(fmt.Sprintf("%s_sz=%d", which, pos), func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
f(data, 'q')
|
||||
}
|
||||
})
|
||||
@@ -54,7 +54,7 @@ func BenchmarkIndexByte2(b *testing.B) {
|
||||
f = index_byte2_scalar
|
||||
}
|
||||
b.Run(fmt.Sprintf("%s_sz=%d", which, pos), func(b *testing.B) {
|
||||
for i := 0; i < b.N; i++ {
|
||||
for b.Loop() {
|
||||
f(data, 'q', 'x')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -48,7 +48,7 @@ func test_cmpeq_epi8(a, b []byte) []byte {
|
||||
func test_cmplt_epi8(t *testing.T, a, b []byte) []byte {
|
||||
ans := make([]byte, len(a))
|
||||
var prev []byte
|
||||
for which := 0; which < 3; which++ {
|
||||
for which := range 3 {
|
||||
if len(ans) == 16 {
|
||||
test_cmplt_epi8_asm_128(a, b, which, ans)
|
||||
} else {
|
||||
@@ -161,7 +161,7 @@ func TestSIMDStringOps(t *testing.T) {
|
||||
}
|
||||
// test alignment issues
|
||||
q := []byte("abc")
|
||||
for sz := 0; sz < 32; sz++ {
|
||||
for sz := range 32 {
|
||||
test(q, '<', '>', sz)
|
||||
test(q, ' ', 'b', sz)
|
||||
test(q, '<', 'a', sz)
|
||||
@@ -172,7 +172,7 @@ func TestSIMDStringOps(t *testing.T) {
|
||||
tests := func(h string, a, b byte) {
|
||||
for _, sz := range []int{0, 16, 32, 64, 79} {
|
||||
q := strings.Repeat(" ", sz) + h
|
||||
for sz := 0; sz < 32; sz++ {
|
||||
for sz := range 32 {
|
||||
test([]byte(q), a, b, sz)
|
||||
}
|
||||
}
|
||||
@@ -326,7 +326,7 @@ func TestIntrinsics(t *testing.T) {
|
||||
if e := test_jump_if_zero(a); e != 0 {
|
||||
t.Fatalf("Did not detect zero register")
|
||||
}
|
||||
for i := 0; i < sz; i++ {
|
||||
for i := range sz {
|
||||
a = make([]byte, sz)
|
||||
a[i] = 1
|
||||
if e := test_jump_if_zero(a); e != 1 {
|
||||
@@ -340,7 +340,7 @@ func TestIntrinsics(t *testing.T) {
|
||||
if e := test_count_to_match(a, 77); e != -1 {
|
||||
t.Fatalf("Unexpectedly found byte at: %d", e)
|
||||
}
|
||||
for i := 0; i < sz; i++ {
|
||||
for i := range sz {
|
||||
if e := test_count_to_match(a, byte(i)); e != i {
|
||||
t.Fatalf("Failed to find the byte: %d (%d != %d)", i, i, e)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ func index_byte2_string_scalar(data string, a, b byte) int {
|
||||
}
|
||||
|
||||
func index_c0_scalar(data []byte) int {
|
||||
for i := 0; i < len(data); i++ {
|
||||
for i := range data {
|
||||
if data[i] == 0x7f || data[i] < ' ' {
|
||||
return i
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user