diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-08-10 13:51:18 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2024-08-10 13:54:12 -0400 |
| commit | 4f816aabb3b008aae201cd092610dfda7f6715c8 (patch) | |
| tree | 9b02103d1f15f645ac325318d291cec7ff91cda4 | |
| parent | 9d2b4b2f03a30e296e55f0f5f9ce33e20303f55b (diff) | |
Use `SIMD_SCAN_WIDTH` constant in `core:bytes` test
| -rw-r--r-- | tests/core/bytes/test_core_bytes.odin | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/core/bytes/test_core_bytes.odin b/tests/core/bytes/test_core_bytes.odin index 72390291f..fb3c460aa 100644 --- a/tests/core/bytes/test_core_bytes.odin +++ b/tests/core/bytes/test_core_bytes.odin @@ -4,15 +4,19 @@ import "core:bytes" import "core:slice" import "core:testing" +@private SIMD_SCAN_WIDTH :: 8 * size_of(uintptr) + @test test_index_byte_sanity :: proc(t: ^testing.T) { // We must be able to find the byte at the correct index. - data := make([]u8, 64) + data := make([]u8, 2 * SIMD_SCAN_WIDTH) defer delete(data) slice.fill(data, '-') - for offset in 0..<31 { - for idx in 0..<31 { + INDEX_MAX :: SIMD_SCAN_WIDTH - 1 + + for offset in 0..<INDEX_MAX { + for idx in 0..<INDEX_MAX { sub := data[offset:] sub[idx] = 'o' if !testing.expect_value(t, bytes.index_byte(sub, 'o'), idx) { |